SUMPRODUCT Returns #VALUE! in Google Sheets
In Google Sheets, unequal SUMPRODUCT ranges can return #N/A or #VALUE!. Read the message, measure both arguments with ROWS, and align the ranges.
本文目录
This formula should total the booked hours for every row where the room is Studio A:
=SUMPRODUCT((B2:B11="Studio A")*(C2:C11))
With the booking log below, it returns 13. If you shorten the hours range to C2:C10, Google Sheets does not return #VALUE!. It returns #N/A, and the message is “Array arguments to MULTIPLY are of different size.”
The comma-separated form of the same function does use #VALUE! for a range mismatch. On this log, =SUMPRODUCT(C2:C11,D2:D9) returns #VALUE!, “SUMPRODUCT has mismatched range sizes. Expected row count: 10. column count: 1. Actual row count: 8, column count: 1.”
The repair for both is the same: give every array the same row count and the same column count.
Enter this fictional rehearsal-room booking log in A1:C11:
| Booked by | Room | Hours |
|---|---|---|
| Maren Solis | Studio A | 2 |
| Joss Hale | Studio B | 3 |
| Rafi Nguyen | Studio A | 1 |
| Petra Lund | Studio A | 3 |
| Cole Brant | Booth | 2 |
| Yara Shin | Studio B | 1 |
| Owen Grier | Studio A | 2 |
| Hana Velez | Studio B | 2 |
| Maren Solis | Studio A | 3 |
| Joss Hale | Studio A | 2 |
Studio A appears in rows 2, 4, 5, 8, 10, and 11. Their hours add up to 2+1+3+2+3+2, or 13. That total is the reference point while you inspect each argument.
An hours range that stops one row early
This broken version is the C2:C10 case from the opening:
=SUMPRODUCT((B2:B11="Studio A")*(C2:C10))
It returns #N/A, “Array arguments to MULTIPLY are of different size.” The condition (B2:B11="Studio A") produces ten TRUE or FALSE values. C2:C10 contains only nine hours, so the * has nothing to pair with the tenth condition.
To see the difference, enter:
=ROWS(B2:B11)
This returns 10. Then:
=ROWS(C2:C10)
returns 9. The widths match: COLUMNS(B2:B11) 与 COLUMNS(C2:C10) both return 1. The heights do not.
You can put the height check in one cell:
=ROWS(B2:B11)=ROWS(C2:C10)
This returns FALSE. After you change the hours reference to C2:C11, the comparison returns TRUE, and the original formula returns 13.
For this booking log, I would keep both ranges closed at row 11. The references describe exactly which bookings belong in the calculation, and a missing endpoint is easier to spot.
Open-ended hours paired with ten room conditions
An open-ended reference is convenient when new bookings are added often. It becomes a problem when only one SUMPRODUCT argument uses it:
=SUMPRODUCT((B2:B11="Studio A")*(C2:C))
On this 1,000-row sheet, ROWS(C2:C) returns 999, while ROWS(B2:B11) is still 10. The formula returns the same #N/A, “Array arguments to MULTIPLY are of different size.”
The reverse arrangement has the same structural problem:
=SUMPRODUCT((B2:B="Studio A")*(C2:C11))
That is also #N/A, with the same message.
If you deliberately want every future booking included, make both references open-ended:
=SUMPRODUCT((B2:B="Studio A")*(C2:C))
With this sample and nothing entered below row 11, that formula returns 13. Matching open-ended references avoid the height mismatch, but they ask SUMPRODUCT to evaluate far more rows than this log needs.
For a fixed report, I prefer matching closed ranges. When the report must grow, use the same endpoint on every argument rather than extending only one column.
Comma-separated arguments and the #VALUE! size message
SUMPRODUCT also accepts arrays as separate comma-separated arguments. To show the numeric form, enter Rate in D1 and these ordinary numbers in D2:D11: 20, 25, 20, 30, 15, 25, 20, 25, 30, 20.
This formula pairs all ten hours values with their rates:
=SUMPRODUCT(C2:C11,D2:D11)
It returns 500: 2×20 + 3×25 + 1×20 + 3×30 + 2×15 + 1×25 + 2×20 + 2×25 + 3×30 + 2×20.
Now shorten the second argument:
=SUMPRODUCT(C2:C11,D2:D9)
ROWS(C2:C11) is 10 与 ROWS(D2:D9) is 8. Both arguments are one column wide. This time the error is #VALUE!, “SUMPRODUCT has mismatched range sizes. Expected row count: 10. column count: 1. Actual row count: 8, column count: 1.” Those Expected and Actual counts are worth reading before you guess which range is short.
Restore the missing rows, and =SUMPRODUCT(C2:C11,D2:D11) returns 500 again. The comma form does not remove the need for matching dimensions. It just reports the mismatch under a different error name than the * form.
A general text-plus-number #VALUE! is a different problem, covered in the general #VALUE! error guide. This page stays on SUMPRODUCT’s own range and type failures.
A transposed hours range returns a wrong total
Range shape is not only about one column stopping early. Start with the working Studio A formula, which returns 13, then transpose the hours:
=SUMPRODUCT((B2:B11="Studio A")*TRANSPOSE(C2:C11))
This does not return #VALUE! or #N/A. It returns 126. The condition is ten rows by one column. ROWS(TRANSPOSE(C2:C11)) is 1 与 COLUMNS(TRANSPOSE(C2:C11)) is 10. Sheets multiplies those arrays into a 10-by-10 grid: each of the six Studio A rows is multiplied by every hours value in C2:C11. Those hours add up to 21, and 6×21 is 126.
That is a wrong total, not an error you can hover over. Unless the calculation specifically needs a horizontal array, remove the transpose and go back to:
=SUMPRODUCT((B2:B11="Studio A")*(C2:C11))
This returns 13 again. Checking both ROWS() 与 COLUMNS() matters, because two arguments can contain the same number of cells without having the same shape.
Text in the hours column is a different kind of #VALUE!
Matching dimensions are the first thing to check, but they are not the only source of #VALUE! in a multiplication.
Replace the numeric 2 in C8 with the literal text two and keep the working ranges:
=SUMPRODUCT((B2:B11="Studio A")*(C2:C11))
This returns #VALUE!, “Function MULTIPLY parameter 2 expects number values. But ‘two’ is a text and cannot be coerced to a number.” ISNUMBER(C8) is FALSE. After you restore the number 2, ISNUMBER(C8) is TRUE and the formula returns 13 again.
A number stored as text is not the same thing. When that Owen Grier hours cell contained the text 2 rather than the number 2, the same * formula still returned 13. Sheets coerced the digit.
The comma form treated the literal text two differently. With hours in C2:C11 and rates in D2:D11, but C8 set to two:
=SUMPRODUCT(C2:C11,D2:D11)
this returned 460, not an error. Row 8 contributed nothing instead of 2×20, and 500−40 is 460. A quiet shortfall is easier to miss than #VALUE!.
If the problem is specifically converting imported numeric text into real numbers, use the separate guide to converting text to numbers. That is a data-type repair, not a reason to change correctly matched SUMPRODUCT ranges.
Boolean conditions in this sample did not cause the error
To inspect the Studio A test itself, enter:
=ARRAYFORMULA(B2:B11="Studio A")
It spills TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, matching the six Studio A rows. Entering =B2:B11="Studio A" without ARRAYFORMULA is a different #VALUE!, about a single-cell default, and it is not a SUMPRODUCT result.
In the original working formula, the * converts those TRUE and FALSE values as it multiplies, and the total is 13. The comma form with an explicit conversion also returns 13:
=SUMPRODUCT(--(B2:B11="Studio A"),C2:C11)
Leaving the conversion out, =SUMPRODUCT(B2:B11="Studio A",C2:C11), also returned 13 on this sheet. That is not a #VALUE! case, and it is not a zero. A SUMPRODUCT that really returns 0 when you expected a total is a different symptom; the guide to COUNTIF, COUNTIFS, and SUMPRODUCT covers that investigation.
For summing hours under one room condition, I would stay with the explicit * formula. The row pairing is visible, and the height mismatch has a clear message.
Why IFERROR is the wrong first repair
You might be tempted to suppress the opening mismatch with:
=IFERROR(SUMPRODUCT((B2:B11="Studio A")*(C2:C10)),0)
The inner formula returns #N/A, and this wrapper displays 0. That is not the correct total. The log contains 13 Studio A hours, and the formula still pairs ten room conditions with nine hours values.
The same 0 could also conceal the comma-form #VALUE! or the text two #VALUE!. Seeing a zero would no longer tell you whether the room had no booked hours or the calculation failed.
Correct the references first, and only consider IFERROR after the formula returns a number or a genuine zero on known-good data. The original formula, with both ranges closed at row 11, returns 13.
Keeping the booking ranges aligned as the log grows
Suppose a new Studio A booking is entered on row 12 with 2 hours. The existing closed formula still returns 13, because row 12 is outside both arguments.
Extend both references together:
=SUMPRODUCT((B2:B12="Studio A")*(C2:C12))
With the new booking entered, this returns 15. Extending only the room condition leaves the mismatch:
=SUMPRODUCT((B2:B12="Studio A")*(C2:C11))
This returns #N/A, “Array arguments to MULTIPLY are of different size.”
Before you change a growing SUMPRODUCT, compare the arguments:
=AND(ROWS(B2:B12)=ROWS(C2:C12),COLUMNS(B2:B12)=COLUMNS(C2:C12))
This returns TRUE for the aligned references. If the second range is C2:C11, the same check returns FALSE. That comparison is more useful than adding an error-handling wrapper. It tells you whether the arrays describe the same rectangle of rows and columns, which is the requirement the booking calculation depends on.