The FILTER function in Excel 365, Excel 2021, and newer Excel 2019 builds returns an array of rows that meet one or more conditions you specify. This guide explains what you need, how to apply the function, common pitfalls, and how to troubleshoot when results are unexpected. Use FILTER whenever you need to extract a subset of a table without creating helper columns or complex formulas.

What You'll Need

  • A version of Excel that supports dynamic arrays. This includes Excel 365, Excel 2021, and Excel 2019 build 1908 or later. Earlier versions such as Excel 2016 do not recognize FILTER and will return a #NAME? error.
  • A worksheet that contains the data you want to filter. The data should be organized in a rectangular range with a single header row.
  • Clear column headers that describe each field. These headers will be referenced in criteria expressions.
  • Optional: a separate criteria range if you prefer to place conditions on the sheet rather than embed them in the formula.

Step-by-Step

  1. Identify the exact range that contains all of your data. For example, suppose column A holds Order ID, column B holds Customer Name, column C holds Region, column D holds Product, and column E holds Amount. If your data starts in row 2 and ends in row 250, the full range is A1:E250. Include the header row (A1:E1) because FILTER can return those headers as part of the spill output.
  2. Make sure there are no merged cells inside the range. Merged cells break the spill behavior and can cause #VALUE! errors.
  3. Decide on the logical test that defines which rows to keep. You can embed the test directly in the formula or reference a separate criteria range on the sheet.
  4. Enter the FILTER function in the cell where you want the results to begin. The syntax is =FILTER(array, include, [if_empty]). Replace array with the full range you identified in step 1.
  5. Replace include with a condition that evaluates to TRUE for rows you want to keep. For a single‑column test, such as showing only rows where Amount is greater than 500, you might write =FILTER(A1:E250, E2:E250>500). For multiple criteria on different columns, combine them with multiplication for AND logic. For example, to show rows where Region is "West" and Product is "Widget", write =FILTER(A1:E250, (C2:C250="West")*(D2:D250="Widget")).
  6. If you want a custom message when no rows meet the criteria, add an if_empty argument, such as =FILTER(A1:E250, (C2:C250="West")*(D2:D250="Widget"), "No matches").
  7. Press Enter. Excel will automatically spill the matching rows into adjacent empty cells, expanding to the right and down as needed. The spill range will include the header row if you included it in the array argument.
  8. If you are using a structured Table, you can reference the table name to make the formula easier to read. For a table named SalesData, the formula might be =FILTER(SalesData, SalesData[Region]=\"West\").
  9. When new rows are added to the bottom of the data set, the spill range updates automatically because the formula still references the original range. If you convert the data to an Excel Table, you can use the table name and the formula will automatically expand to include new rows.

Concrete Example

Imagine a sales table that starts in A1 with headers: OrderID, Customer, Region, Product, Amount. The data runs to row 150. You want to see every order from the West region for the product "Gizmo" where the Amount exceeds $1,200. First, confirm that the range to filter is A1:E150. Next, write the formula in cell G1:

 =FILTER(A1:E150, (C2:C150="West")*(D2:D150="Gizmo")*(E2:E150>1200), "No records")

The formula returns all rows that satisfy all three conditions. Because the array includes the header row, the spill will place the headers in G1:K1 and then fill G2:K with the matching records. If you later add new orders below row 150, the formula will still evaluate them as long as they are within the original range or you extend the range in the formula.

Common Mistakes

  • Using a range that excludes the header row when you later try to reference fields by name in the criteria. This can cause the criteria to misalign with the data.
  • Placing the FILTER formula in a cell that already contains a value. The result will be a #SPILL! error because Excel cannot expand into occupied cells.
  • Writing criteria that reference the wrong cell range. For example, using E2:E150>500 when the Amount column is actually column D will produce no matches.
  • Assuming FILTER works in Excel 2016 or earlier. In those versions the function is not recognized and will return a #NAME? error.
  • Including extra spaces or hidden characters in criteria text. Text such as " West" (with a leading space) will not match "West" and will cause the condition to evaluate as FALSE.

Tips

  • When your data is formatted as an Excel Table, use structured references. For a table named Orders, the formula becomes =FILTER(Orders, Orders[Region]=\"North\", which is easier to read and automatically expands as the table grows.
  • Combine FILTER with SORT to order the results. For instance, =SORT(FILTER(Orders, Orders[Region]=\"South\"), 5, -1) sorts the filtered rows by the Amount column in descending order.
  • If you need to filter on a list of acceptable values, you can use the MATCH function inside an ISNUMBER test. Example: returns rows where Product is either Widget or Gadget.
  • When working with dates, remember that Excel stores dates as serial numbers. To filter rows where the Order Date is after January 1, 2024, use =FILTER(Orders, Orders[OrderDate] > DATE(2024,1,1)).
  • Document any criteria range you use on the worksheet. Keeping the criteria in a separate area makes it easy to adjust conditions without editing the formula directly.

Advanced Scenarios

FILTER can also be used to return columns instead of rows by combining it with the TRANSPOSE function, but the more straightforward approach is to use FILTER on a range that has been oriented vertically and then transpose the result. For example, to extract only the Customer and Amount columns for the previous example, you could place the formula in two cells side by side and use =TRANSPOSE(FILTER(A1:E150, (C2:C150="West")*(E2:E150>1200))). This returns a vertical array that can be reshaped as needed.

Another powerful use is to filter based on a dynamic list of values stored in a separate range. Suppose column H contains a list of Region names you want to include. You can write =FILTER(Orders, ISNUMBER(MATCH(Orders[Region], $H$2:$H$10, 0)). As you add or remove regions in column H, the filter updates automatically.

Troubleshooting

When FILTER does not behave as expected, follow these steps in order:

  1. Spill error: Verify that the cell where you entered the formula and the cells to its right and below are completely empty. If any content occupies those cells, Excel cannot expand the result and will display #SPILL!. Clear the obstructing content and try again.
  2. No rows returned: Double‑check the criteria. A common mistake is forgetting to enclose text criteria in double quotation marks. For example, writing =FILTER(A1:E100, C2:C100=West) will cause an error; it must be =FILTER(A1:E100, C2:C100="West").
  3. Incorrect data type: Numbers stored as text will not pass numeric comparisons. Convert such cells to true numbers using VALUE or re‑enter the data.
  4. Range mismatch: Ensure that the include range exactly matches the dimensions of the array range. If the array is 150 rows tall but the criteria range is only 140 rows, some rows will be ignored.
  5. Version compatibility: If you receive a #NAME? error, you are likely using an Excel version that does not support dynamic arrays. In that case, consider upgrading or using the older Advanced Filter feature, which requires a separate criteria range on the worksheet.
  6. Hidden rows or filtered tables: FILTER does not respect manual row hiding or table filters. It evaluates the raw data, so hidden rows will still be considered unless they are outside the specified range.

Additional Section: Using FILTER with Multiple OR Conditions

Excel’s logical operators allow you to combine multiple OR conditions easily. Use addition (+) to join conditions that are meant to be OR logic, and multiplication (*) for AND logic. For example, to retrieve rows where Region is either "West" or "East" and the Amount is greater than 1000, write:

 =FILTER(A1:E150, (C2:C150="West")+(C2:C150="East"))*(E2:E150>1000)

Because multiplication has higher precedence, it is safer to wrap each group of conditions in parentheses before multiplying them together. This ensures that each group is evaluated as a single Boolean value before the groups are combined.

If you prefer to keep the OR logic separate from the numeric condition, you can nest the OR test inside a larger expression:

 =FILTER(A1:E150, ((C2:C150="West")+(C2:C150="East"))*(E2:E150>1000))

This approach is useful when you have many possible values for a column and want to avoid writing a long list of separate criteria.

Additional Section: Using FILTER with a Named Range

Giving your data range a name can make formulas more readable and reduce errors. Select the entire block of data including headers, then go to the Name Box (left of the formula bar) and type a name such as SalesTable. Press Enter. Now the FILTER formula can reference this name directly:

 =FILTER(SalesTable, SalesTable[Region]=\"South\", SalesTable[Amount]>500)

When you later insert new rows into the named range, the name automatically expands if the new rows are contiguous. This eliminates the need to constantly adjust the range reference in the formula.

Final Checks Before Using FILTER

  • Confirm that the workbook is saved in a format that preserves dynamic array behavior (the default .xlsx format does this).
  • Ensure that the workbook is not opened in Compatibility Mode, which can disable some newer functions.
  • Check that no other workbook is using the same sheet name and that the formula is not duplicated on the same sheet, which could cause circular reference warnings.
  • If you are sharing the workbook with users of older Excel versions, consider adding a note that the FILTER function requires a recent version of Excel.