Very strange SUMPRODUCT failure to return

JoeJackson12

New Member
Joined
Jun 26, 2017
Messages
22
Hi All, I have a code that works great for returning information from cells that contain numbers derived from formulas, but not when one of the values can be
Code:
""
or
Code:
NA()
. The code is
Code:
=SUMPRODUCT(($G$6:$M$9)*(F6:F9="butter")*(E6:E9="low"))
The layout looks like:

Code:
[TABLE="width: 648"]
<tbody>[TR]
[TD="width: 72, bgcolor: transparent"][FONT=Arial][SIZE=3][COLOR=#002856]high[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl65, width: 72, bgcolor: #F3F3F3"][B][FONT=Arial][SIZE=3][COLOR=#002856]eggs[/COLOR][/SIZE][/FONT][/B]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]33[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]31[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]38[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]46[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]14[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]3[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, width: 72, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]21[/COLOR][/SIZE][/FONT]
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][FONT=Arial][SIZE=3][COLOR=#002856]low[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl65, bgcolor: #F3F3F3"][B][FONT=Arial][SIZE=3][COLOR=#002856]butter[/COLOR][/SIZE][/FONT][/B]
[/TD]
[TD="class: xl66, bgcolor: transparent"][FONT=Arial][SIZE=3][COLOR=#002856]NA()[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]4[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]34[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]8[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]43[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]31[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]34[/COLOR][/SIZE][/FONT]
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][FONT=Arial][SIZE=3][COLOR=#002856]low[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl65, bgcolor: #F3F3F3"][B][FONT=Arial][SIZE=3][COLOR=#002856]bacon[/COLOR][/SIZE][/FONT][/B]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]21[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]30[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]39[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]8[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]45[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]47[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]42[/COLOR][/SIZE][/FONT]
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][FONT=Arial][SIZE=3][COLOR=#002856]low[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl65, bgcolor: #F3F3F3"][B][FONT=Arial][SIZE=3][COLOR=#002856]butter[/COLOR][/SIZE][/FONT][/B]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]11[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]29[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]7[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]25[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]26[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]40[/COLOR][/SIZE][/FONT]
[/TD]
[TD="class: xl66, bgcolor: transparent, align: right"][FONT=Arial][SIZE=3][COLOR=#002856]8[/COLOR][/SIZE][/FONT]
[/TD]
[/TR]
</tbody>[/TABLE]

The NA() makes it not work. I can't put zeros in there because sometimes the actual value is a zero. I also can't put a
Code:
""
, that has the same effect as the NA(). The cell values themselves are derived from formulas. Any help is much appreciated, thanks!
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I think you'll need an array formula, entered with CTRL + SHIFT + ENTER

=SUM(IF(F6:F9="butter",IF(E6:E9="low",IF(ISNUMBER($G$6:$M$9),$G$6:$M$9))))
 
Upvote 0
if the NA is comin g from a formula, why not use "" instead? Same affect as a 0 in this case, but it will look empty
 
Upvote 0
if the NA is comin g from a formula, why not use "" instead? Same affect as a 0 in this case, but it will look empty

An alternative is to use IFERROR making the formula return a text, N/A for example, rather than the error #N/A, and use
=SUMPRODUCT((N(+$G$6:$M$9))*(F6:F9="butter")*(E6:E9="low"))

M.
 
Upvote 0
An alternative is to use IFERROR making the formula return a text, N/A for example, rather than the error #N/A, and use
=SUMPRODUCT((N(+$G$6:$M$9))*(F6:F9="butter")*(E6:E9="low"))

M.

Good catch Jonmo, and nice alternative Marcelo :)
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top