Excel #CALC! Error: Fix FILTER With No Matches

When FILTER finds no rows, Excel shows #CALC! and Google Sheets shows #N/A. Choose a display fallback, then count and sum from the source data.

本文目录

Your Excel report works until someone picks a region with no sales. The FILTER formula in J2 shows #CALC!, and every total that points at that output breaks with it.

Microsoft’s FILTER documentation says this happens because FILTER returned no rows, and “Excel does not currently support empty arrays.” The usual fix is the optional third argument, if_empty:

=FILTER(A2:E11,B2:B11=H2,"No matches")

That stops the error. It does not, by itself, give you a reliable count or total, because the fallback is one cell, not zero rows.

Google Sheets does not use #CALC! here. In a US-locale test file, the same formula without a fallback returned #N/A with the message “No matches are found in FILTER evaluation.” Sheets also has no if_empty argument, so the Excel formula above is not portable. The pattern I’d use in both apps comes after the sample.

A small sales list to rebuild

Enter this table in A1:E11. Type the dates as real dates, not text, and the amounts as numbers.

DateRegionRepTicketAmount
2026-11-02EastMayaT-101420
2026-11-02WestLeoT-102310
2026-11-03EastNinaT-103180
2026-11-04SouthOmarT-104275
2026-11-05WestLeoT-105640
2026-11-06EastMayaT-106350
2026-11-09NorthPriyaT-107510
2026-11-10SouthOmarT-108225
2026-11-11WestNinaT-109190
2026-11-12EastMayaT-110460

In G1 type Selected region. Enter East in H2, then later change it to Central, a region that does not appear. For a two-condition count, enter Maya in H3.

With East in H2, this formula in J2:

=FILTER(A2:E11,B2:B11=H2)

returns four rows: tickets T-101, T-103, T-106, and T-110, with amounts 420, 180, 350, and 460. Those amounts add up to 1410.

Change H2 to Central. Excel behavior in this article follows Microsoft’s documentation; the worked examples were tested in Google Sheets. Microsoft’s page on #CALC! uses a FILTER that finds no rows as its empty-array example, and its FILTER function page says to supply if_empty or a #CALC! error will result. FILTER itself is documented for Excel for Microsoft 365, Excel 2024, and Excel 2021. In Google Sheets, J2 returned #N/A with the message above.

The fallback is one cell, not an empty table

These three Excel formulas all supply if_empty. Microsoft’s syntax is =FILTER(array, include, [if_empty]):

=FILTER(A2:E11,B2:B11=H2,"")
=FILTER(A2:E11,B2:B11=H2,0)
=FILTER(A2:E11,B2:B11=H2,"No matches")

The usual Sheets substitute is to wrap FILTER in IFNA with those same three fallback values:

=IFNA(FILTER(E2:E11,B2:B11=H2),"")
=IFNA(FILTER(E2:E11,B2:B11=H2),0)
=IFNA(FILTER(E2:E11,B2:B11=H2),"No matches")

With Central in H2, every fallback occupied one cell, and downstream functions disagreed with each other:

FallbackWhat appearsCOUNTACOUNTROWSSUMAVERAGE
""Visually blank101#VALUE!#VALUE!
0011100
"No matches"No matches101#VALUE!#VALUE!

A few details from the same Sheets file: ISBLANK on the "" fallback returned FALSE, and LEN returned 0, so the cell is not truly empty. COUNTA also returned 1 for a raw FILTER #N/A, because it counts the error. SUM of the "" fallback reported that parameter 1 “expects number values. But ” is a text and cannot be coerced to a number.” Adding 1 to No matches returned #VALUE! as well. TEXTJOIN(", ",TRUE,…) ignored the blank fallback, returned No matches for the text fallback, and returned 0 for the numeric one.

Microsoft’s COUNTA page says COUNTA “counts cells containing any type of information, including error values and empty text ("")”, and that a formula returning an empty string is counted. The SUM and AVERAGE columns in the table are from the Sheets file.

The practical point is the same in both apps: do not use COUNTA or ROWS on the FILTER output as your record count. The 0 fallback is the only one of the three that kept SUM and AVERAGE numeric in Sheets, but COUNTA still reported 1. I’d rather not lean on that for a production total.

Count and sum the source, not the spill

=COUNTIFS(B2:B11,H2)
=SUMIFS(E2:E11,B2:B11,H2)

In the test file, East returned 4 and 1410, West 3 and 1140, South 2 and 500, North 1 and 510, and Central 0 and 0. With Maya in H3, =COUNTIFS(B2:B11,H2,C2:C11,H3) returned 3 for East and 0 for Central.

=ARRAYFORMULA(SUM(--(B2:B11=H2))) also returned 4 and 0, but COUNTIFS is easier to read for ordinary criteria. =IFERROR(ROWS(FILTER(D2:D11,B2:B11=H2)),0) returned 4 for East and 0 for Central, yet it would also turn a broken formula into zero. That risk is sharper in Sheets than it first looks, because a FILTER condition range that is one row short also returns #N/A.

Don’t paste Excel’s if_empty into Google Sheets

I entered =FILTER(A2:E11,B2:B11=H2,"No matches") in Sheets with East selected, then with Central, and also tried 0 与 "" as the third argument. Every case returned #N/A. The message was “FILTER has mismatched range sizes. Expected row count: 10. column count: 1. Actual row count: 1, column count: 1.” Sheets treated the third argument as another condition, not as a fallback. A broader comparison of the two functions, including this syntax split, is in FILTER vs QUERY in Google Sheets.

The wrapper people reach for is:

=IFNA(FILTER(A2:E11,B2:B11=H2),"No matches")

That displayed the four East rows, and No matches for Central. IFERROR did the same. The problem is the mismatch case. This formula, with the condition range one row short, also returned #N/A:

=FILTER(A2:E11,B2:B10=H2)

The message was the mismatched-range text, not “No matches are found in FILTER evaluation.” Both IFNA and IFERROR replaced it with No matches. IFERROR vs IFNA still matters for lookups, where a missing key is #N/A and a typo is often some other error. Here, Sheets uses #N/A for more than one FILTER failure, so IFNA is not a precise no-match test.

Microsoft’s FILTER page says an empty FILTER result in Excel is #CALC!, not #N/A. IFNA only catches #N/A, so it would not hide a #CALC!. The guard I would use in both apps is:

=IF(COUNTIF(B2:B11,H2)=0,"No matches",FILTER(A2:E11,B2:B11=H2))

East still spilled the four rows. Central displayed No matches. FILTER never ran in the no-match branch, so a missing region cannot be confused with a truncated condition range.

The same idea works for a distinct, sorted list of representatives:

=IF(COUNTIFS(B2:B11,H2)=0,"No matches",SORT(UNIQUE(FILTER(C2:C11,B2:B11=H2))))

For East that returned Maya and Nina. For Central, No matches. Without the guard, UNIQUE(FILTER(C2:C11,B2:B11=H2)) 与 SORT(UNIQUE(FILTER(C2:C11,B2:B11=H2))) both returned #N/A in Sheets when nothing matched. Microsoft’s empty-array note would apply to the inner FILTER in Excel.

A blocked spill is a different error

If East is selected and something already sits in the cells FILTER needs to fill, Excel reports #SPILL!, not #CALC!. That problem, especially inside a table, is covered in Excel #SPILL! errors in tables. Sheets has its own expansion error when a spill is blocked. FILTER’s fallback will not clear either of those.

Other documented #CALC! causes in Excel

Microsoft’s #CALC! page also lists a nested array (Excel “can’t calculate an array within an array”), an array of range references such as =OFFSET(A1,0,0,{2,3}), and a LAMBDA entered in a cell without calling it, for example =LAMBDA(x, x+1), which Microsoft lists as returning #CALC!. FILTER’s if_empty argument does not fix those.

In Google Sheets, =BYROW(D2:E11,LAMBDA(r,SUM(r))) returned the ten amounts; SUM ignored the ticket IDs in column D. =BYROW(D2:E11,LAMBDA(r,r)) spilled the original two-column range rather than erroring. =OFFSET(E2,0,0,{2,3}) returned 420 and 310 and did not error. An uncalled =LAMBDA(x,x+1) returned #N/A with “Function LAMBDA should be followed by a call containing the actual values.” =LAMBDA(x,x+1)(1) returned 2.

Keep the list, the count, and the total separate

I’d put the visible list, the record count, and the amount total on three formulas: the IF/COUNTIF display (or Excel’s if_empty) in J2, =COUNTIFS(B2:B11,H2) for the count, and =SUMIFS(E2:E11,B2:B11,H2) for the total. East then shows four rows, 4, and 1410. Central shows No matches, 0, and 0. The totals never depend on whether the list cell holds a message, a blank-looking string, or a spilled array.

Oscar

写 Excel 与 Google Sheets 的公式和排错。

Google Sheets, 19 November 2026, new private unshared spreadsheet (locale en_US). The existing private test workbook is locale zh_CN, so that locale was left unchanged and a new file was used instead. Formulas were entered as user input through the Sheets API. On the sales sample below, FILTER with no matches returned #N/A, "No matches are found in FILTER evaluation." Excel's if_empty third argument is not supported in Sheets: a third argument was treated as another condition and returned #N/A, "FILTER has mismatched range sizes." IFNA and IFERROR both replaced that mismatch error as well as the no-match error. COUNTA counted a formula blank (""), a 0 fallback, a "No matches" fallback, and a raw FILTER #N/A as 1. SUM and AVERAGE of a "" or text fallback returned #VALUE!. COUNTIFS and SUMIFS on the source returned 4 and 1410 for East, 0 and 0 for Central. Excel was not run. Statements about Excel #CALC!, if_empty, and COUNTA counting empty text follow Microsoft's FILTER, #CALC!, and COUNTA pages.

本主题下一篇:表格错误与动态数组 QUERY #N/A: Query Completed With an Empty Output