COUNTIFS Returns #VALUE! in Google Sheets
COUNTIFS returns #VALUE! when criteria ranges are different sizes. The measured message was Array arguments to COUNTIFS are of different size.
On this page
These two formulas use the same criteria. Only the height of the glaze range is different.
=COUNTIFS(B2:B11,"Front",C2:C11,"celadon")
returns 3.
=COUNTIFS(B2:B11,"Front",C2:C10,"celadon")
returns #VALUE!. The message is: Array arguments to COUNTIFS are of different size.
COUNTIFS does not skip the extra row and keep counting. The criteria ranges have to be the same size. A #VALUE! here is a size problem, not a “no rows matched” result. That case returned 0.
The formulas refer to this pottery-studio firing log in A1:D11:
| Firing | Kiln | Glaze | Cones |
|---|---|---|---|
| F-118 | Front | celadon | 6 |
| F-119 | Annex | shino | 10 |
| F-120 | Front | ash | 6 |
| F-121 | Test | celadon | 6 |
| F-122 | Front | celadon | 10 |
| F-123 | Annex | ash | 6 |
| F-124 | Front | shino | 10 |
| F-125 | Test | shino | 6 |
| F-126 | Front | celadon | 6 |
| F-127 | Annex | celadon | 10 |
Ten firings sit in A2:D11. Three of them are Front kiln loads with celadon glaze: F-118, F-122, and F-126. The working formula counts those three rows because B2:B11 and C2:C11 both cover ten cells, and COUNTIFS compares B2 with C2, B3 with C3, and so on.
A criteria range that is one row short, or one row long
The broken formula uses C2:C10 (nine cells) against B2:B11 (ten cells). It returns #VALUE! and the message above. Extending the glaze range through row 11 restores the count of 3.
The same message appears when the glaze range is one row too long:
=COUNTIFS(B2:B11,"Front",C2:C12,"celadon")
C12 does not need a value. The reference is already eleven cells, so the sizes still differ. Bringing it back to C2:C11 returns 3.
Equal height is not the same as the same rows
This pair has nine cells on each side, so it is not a size error:
=COUNTIFS(B2:B10,"Front",C3:C11,"celadon")
It returned 2, not 0. B2 is compared with C3, B3 with C4, and so on, so the conditions are no longer from the same firing. Two of those shifted pairs happened to match in this file. If you want both tests on one record, start and end the ranges on the same rows:
=COUNTIFS(B2:B11,"Front",C2:C11,"celadon")
That is the formula that returned 3. I prefer closed ranges like these when I am checking a broken count, because the height is visible in the formula.
A whole column mixed with a limited range
=COUNTIFS(B:B,"Front",C2:C11,"celadon")
returns #VALUE! and the same COUNTIFS size message. B:B and C2:C11 are not the same height.
If the log will grow, give every criteria the same open end, starting on the same row:
=COUNTIFS(B2:B,"Front",C2:C,"celadon")
This returned 3 on the original ten rows. After a new Front celadon firing, F-128, was entered in row 12, the same formula returned 4. A closed formula that still stopped at row 11 stayed at 3.
A width mismatch fails the same way. COUNTIFS(B2:C11,"Front",D2:D11,6) returned #VALUE! and the same message, because B2:C11 is two columns wide and D2:D11 is one.
SUMIFS uses the same size rule
SUMIFS adds instead of counting, and it has the same requirement for the sum range and every criteria range. The three Front celadon cone values are 6, 10, and 6.
=SUMIFS(D2:D11,B2:B11,"Front",C2:C11,"celadon")
returns 22. Shortening the glaze range:
=SUMIFS(D2:D11,B2:B11,"Front",C2:C10,"celadon")
returns #VALUE!. The message is: Array arguments to SUMIFS are of different size. Shortening only the sum range to D2:D10 produced the same SUMIFS message. Restoring D2:D11 with C2:C11 returns 22 again.
A valid formula with no matches returns 0
There is no Front kiln firing with ash glaze and cone 10 in this log.
=COUNTIFS(B2:B11,"Front",C2:C11,"ash",D2:D11,10)
returns 0, not #VALUE!. The ranges are the same height; nothing matched.
=COUNTIFS(B2:B11,"Front",C2:C10,"ash",D2:D11,10)
returns #VALUE! and the COUNTIFS size message, even though the criteria would not have matched anyway. If you see 0, inspect the criteria. If you see #VALUE! with that size message, inspect the range heights first.
Wrapping the short-range formula in IFERROR is the wrong first repair:
=IFERROR(COUNTIFS(B2:B11,"Front",C2:C10,"celadon"),0)
This returned 0 while the real count is 3. The fallback looks like a valid no-match result and hides the broken ranges.
FILTER can also fail when its ranges are different sizes, and SUMPRODUCT can fail when its arrays do not line up. Those are different functions and different messages. For when to use COUNTIF, COUNTIFS, or SUMPRODUCT, see the comparison guide. If a sum is 0 even though rows look as if they should match, see SUMIF or SUMIFS returns 0. Broader #VALUE! cases are in the #VALUE! guide.
Extending only one range after a new row
After the table gained a blank row 12, this formula failed with the COUNTIFS size message, because the kiln range had eleven cells and the glaze range still had ten:
=COUNTIFS(B2:B12,"Front",C2:C11,"celadon")
Extending both ranges to row 12 returned 3 while that row was still blank, then 4 after F-128 was entered as a Front celadon firing. The new row cannot be counted until every criteria range includes it.