How to Fix LINEST #VALUE! Error with Filtered Excel Arrays
Question details
The user needs to fix a #VALUE! error that occurs when calculating regression statistics using the LINEST function on filtered arrays that contain nonnumeric data.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Performing linear regression analysis using the LINEST function on datasets that have been filtered and may include blank cells, logical values, or text.
- Observed behavior
- Unlike the SLOPE function, which ignores text and empty cells, LINEST returns a #VALUE! error when evaluating arrays with nonnumeric values.
Ensure you know whether your version of Excel supports dynamic array functions like FILTER, as this will determine the most efficient method to fix the array issue.
Use the FILTER Function to Exclude Nonnumeric Values
For modern spreadsheet software supporting dynamic arrays, nest the FILTER function inside LINEST to pass strictly numerical matching data.
The LINEST function is strict regarding data types and will fail with a #VALUE! error if it processes text, blanks, or logical values. By applying the FILTER function first, you dynamically isolate valid numeric values before passing the arrays to LINEST.
Locate the arrays for your known_y's and known_x's in your worksheet (for example, Data!C2:C1000 and Data!D2:D1000).
Write a FILTER function to extract only the relevant rows based on your criteria, such as FILTER(Data!C2:C1000, Data!A2:A1000=A1).
Combine the filtered arrays into your LINEST function: =LINEST(FILTER(Data!C2:C1000, Data!A2:A1000=A1), FILTER(Data!D2:D1000, Data!A2:A1000=A1), TRUE, TRUE).
Press Enter to execute the formula. LINEST will now calculate the regression statistics exclusively on valid numeric data, bypassing the #VALUE! error.

Preprocess Data Manually or Using VBA (Older Versions)
If your software lacks the FILTER function, you must clean your data manually or aggregate numeric values using a VBA macro before applying LINEST.
Perform Seamless Statistical Analysis with WPS Office
WPS Office fully supports dynamic array formulas, including the FILTER function, and complex statistical calculations like LINEST. You can smoothly resolve array errors and perform advanced regressions in WPS Spreadsheet.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the workbook containing the data you wish to analyze.
- 2. Select the output cell: Click on the cell or highlight the range where you want the regression statistics to be displayed.
- 3. Input the nested formula: Type your combined formula, for example: =LINEST(FILTER(B2:B100, A2:A100="Yes"), FILTER(C2:C100, A2:A100="Yes"), TRUE, TRUE).
- 4. Calculate statistics: Press Enter. WPS Spreadsheet will instantly filter the nonnumeric data and process the regression correctly.

Frequently Asked Questions
Why does SLOPE work with my filtered data but LINEST returns a #VALUE! error?
The SLOPE function is designed to automatically ignore text, logical values, and empty cells inside array arguments. LINEST is much stricter and requires the arrays to contain only valid numeric data, which is why it throws an error when it encounters unfiltered text or blanks.
What does the TRUE, TRUE at the end of the LINEST formula do?
The first TRUE argument tells the LINEST function to calculate the y-intercept (b) normally. The second TRUE argument instructs it to output additional regression statistics, such as the standard error, R-squared value, and F-statistic.
Can I resolve the LINEST #VALUE! error without using the FILTER function?
Yes. If you are using an older version of Excel that does not support FILTER, you can fix the error by manually cleaning and sorting your data to remove blanks and text before referencing the range, or by using a VBA macro to extract only numeric values dynamically.




