FILTER Has Mismatched Range Sizes in Google Sheets
Fix the Google Sheets FILTER mismatched range sizes error by comparing row and column counts, finding the shorter condition range, and aligning references.
本文目录
The FILTER formula in J2 worked yesterday. This morning it shows #N/A, and the message is “FILTER has mismatched range sizes.” Someone added a name at the bottom of the café shift roster but didn’t extend the Station condition, so the data range is one row longer than the condition.
The repair is to make both ranges cover the same rows. Before you change the formula, read the row and column counts in the error. Those numbers tell you which argument has the wrong shape.
Here is the roster. Enter the headers in A1:D1 and the nine staff records in A2:D10. Leave B10 genuinely empty. Tess Qian is the new name, and nobody has assigned her a station yet.
| Name | Station | Shift | On call |
|---|---|---|---|
| Kit Alvarez | Bar | Open | Yes |
| June Okada | Pastry | Open | No |
| Remy Walsh | Bar | Close | Yes |
| Pauline Cho | Register | Open | No |
| Hugo Nair | Pastry | Close | Yes |
| Imani West | Bar | Open | No |
| Dario Voss | Register | Close | Yes |
| Sera Malik | Pastry | Open | Yes |
| Tess Qian | Close | No |
The working formula in J2 is:
=FILTER(A2:B10,B2:B10="Bar")
It returns three names with their stations: Kit Alvarez, Remy Walsh, and Imani West, each paired with Bar.
The blank Station cell in B10 does not break FILTER. ISBLANK(B10) is TRUE, and the empty cell simply fails the "Bar" test. A missing value is different from a missing row in a referenced range.
Read the Expected and Actual counts before editing
The broken formula in J2 was:
=FILTER(A2:B10,B2:B9="Bar")
The data range A2:B10 contains nine rows and two columns. The condition B2:B9 contains eight rows and one column. This formula returned #N/A, with the message “FILTER has mismatched range sizes. Expected row count: 9. column count: 1. Actual row count: 8, column count: 1.”
The expected column count refers to the condition’s shape, not the two columns being returned by A2:B10. FILTER needs one condition value per data row.
You can measure the ranges in unused cells. =ROWS(A2:B10) returns 9, and =ROWS(B2:B9) returns 8. =COLUMNS(A2:B10) returns 2, and =COLUMNS(B2:B9) returns 1. The 2-versus-1 column counts are valid here, because the FILTER is selecting rows and the condition is one column wide. The error is the 9-versus-8 row count.
The Station reference stops one row early
Extending the condition through B10 fixes the mismatch:
=FILTER(A2:B10,B2:B10="Bar")
The corrected formula returns Kit Alvarez, Remy Walsh, and Imani West with Bar in the adjacent result column. You do not need to fill B10 with a station just to satisfy FILTER. Extending the reference changes only which rows are evaluated; filling in “Bar” would invent an assignment.
A similar error appears when the Name range is extended to A11 but the condition stays at B10:
=FILTER(A2:A11,B2:B10="Bar")
A2:A11 contains ten rows, B2:B10 contains nine, and the message is “FILTER has mismatched range sizes. Expected row count: 10. column count: 1. Actual row count: 9, column count: 1.” The mismatch occurs even though A11 is empty. ROWS(A2:A11) returns 10 because ROWS measures the reference, not the number of filled cells.
The aligned version is:
=FILTER(A2:A10,B2:B10="Bar")
It returns the same three Bar employees.
An open-ended Name range paired with a closed Station range
Making only the Name range open-ended does not solve the size problem:
=FILTER(A2:A,B2:B8="Bar")
A2:A runs from row 2 to the bottom of the sheet. On this 1,000-row file, ROWS(A2:A) is 999, and ROWS(B2:B8) is 7. The message is “FILTER has mismatched range sizes. Expected row count: 999. column count: 1. Actual row count: 7, column count: 1.” If the sheet has a different number of rows, the Expected count changes with it.
The fix is to use matching open-ended references:
=FILTER(A2:A,B2:B="Bar")
This returns Kit Alvarez, Remy Walsh, and Imani West. Both references begin at row 2 and continue to the bottom of the same sheet, so their heights match.
The reverse mismatch also fails:
=FILTER(A2:A10,B2:B="Bar")
The Name range contains nine rows, the Station condition is 999 rows on this sheet, and the message is “FILTER has mismatched range sizes. Expected row count: 9. column count: 1. Actual row count: 999, column count: 1.” Use matching closed ranges instead:
=FILTER(A2:A10,B2:B10="Bar")
This returns the same three names.
For a roster that grows every week, I’d use matching open-ended references. For a fixed weekly export, I’d use matching closed references. I wouldn’t mix the two without a deliberate reason. An open-ended FILTER also evaluates rows below the visible roster; if a later row has Bar in column B, that name becomes eligible. Keep the Station column clean below the actual staff records.
A third condition ends before the other two
Suppose the manager wants Bar employees who work the Open shift and are marked Yes for on-call duty. This formula is broken because the On call condition stops at D9:
=FILTER(A2:A10,B2:B10="Bar",C2:C10="Open",D2:D9="Yes")
ROWS(D2:D9) returns 8, while ROWS(A2:A10) returns 9. The message is again “FILTER has mismatched range sizes. Expected row count: 9. column count: 1. Actual row count: 8, column count: 1.” Even though the first two conditions match the data range, FILTER still fails on the shorter third argument.
Extend the On call reference:
=FILTER(A2:A10,B2:B10="Bar",C2:C10="Open",D2:D10="Yes")
The corrected formula returns Kit Alvarez. Remy Walsh works Close, and Imani West has No in the On call column, so neither meets all three conditions.
For a different check, remove the Station condition and look for everyone working Open who is on call:
=FILTER(A2:A10,C2:C10="Open",D2:D10="Yes")
This returns Kit Alvarez and Sera Malik. Every condition must cover the same rows as the data range. A condition range that contains blank cells can still be a valid nine-row range; use ROWS on each argument rather than counting the visible Yes values.
A third FILTER argument mistaken for an empty-result message
Google Sheets FILTER has no fallback argument for an empty result. Its third argument is another condition. This formula treats the text as that condition:
=FILTER(A2:A11,B2:B11="Bar","No matches")
It returned #N/A, with the message “FILTER has mismatched range sizes. Expected row count: 10. column count: 1. Actual row count: 1, column count: 1.” The first condition covers ten rows; "No matches" is a single value. Remove the scalar third argument and align the data and condition ranges:
=FILTER(A2:A10,B2:B10="Bar")
This returns Kit Alvarez, Remy Walsh, and Imani West. Empty FILTER results and fallback values are in FILTER with no matches.
A missing match is not a range-size mismatch
A FILTER with correctly sized ranges can still return #N/A when no records satisfy the condition:
=FILTER(A2:A10,B2:B10="Kitchen")
There are no Kitchen assignments in this roster. The message is “No matches are found in FILTER evaluation.” That failure is covered in FILTER with no matches. It is not a broken reference.
If a FILTER result needs several cells but something already occupies its destination, Sheets reports “Array result was not expanded…” rather than a mismatched-range-sizes message. See array result was not expanded. Switching to QUERY is not required to correct a one-row-short condition; the FILTER vs QUERY comparison is for a larger reporting choice.
Why IFNA hides the broken roster reference
This wrapper looks tidy and is still wrong:
=IFNA(FILTER(A2:A10,B2:B9="Bar"),"No matches")
It returns No matches even though the roster contains three Bar employees. The problem is that B2:B9 is shorter than A2:A10. IFERROR around the same short condition also displayed No matches. Both wrappers hide a damaged reference and a genuinely empty result behind the same fallback.
I’d leave the raw FILTER error visible until the ranges are aligned:
=FILTER(A2:A10,B2:B10="Bar")
This returns the three Bar employees. For a count, use the source, not the spill or a fallback:
=COUNTIF(B2:B10,"Bar")
This returns 3.
=COUNTIFS(B2:B10,"Bar",C2:C10,"Open")
This returns 2: Kit Alvarez and Imani West. The same idea applies to totals: use SUMIFS against the source rather than summing a FILTER output that might have been replaced by text.
Keep new roster rows inside every condition
If the café uses a fixed roster area, keep every FILTER reference on the same row boundaries:
=FILTER(A2:B10,B2:B10="Bar")
It returns the three current Bar employees. When the roster expands, update both references together.
If staff records are added regularly, use matching open-ended ranges:
=FILTER(A2:B,B2:B="Bar")
This also returns the three current Bar employees and their stations, and future rows can be included without extending each reference by hand. The deciding factor is whether the ranges have the same shape, not whether they contain the same number of nonblank cells. Compare ROWS 与 COLUMNS for the data range and every condition before you edit a mismatched FILTER. In this roster, changing B2:B9 to B2:B10 repairs J2 without inventing a station for Tess Qian.