Conditional SUMPRODUCT to also ignore blanks

cfdh_edmundo

Board Regular
Joined
Nov 9, 2005
Messages
133
Hi,

I have the following code which calculates a weighted average:

Rich (BB code):
=SUMPRODUCT(--($U$2:$U$1203=AE3),$AB$2:$AB$1203,$C$2:$C$1203)/SUMIF($U$2:$U$1203,AE3,$C$2:$C$1203)

It works very well except that I would like it to ignore blank cells in the range $AB$2:$AB$1203

I tried to change it to the following code

Rich (BB code):
=SUMPRODUCT(--($U$2:$U$1203=AE3),$AB$2:$AB$1203,(LEN($AB$2:$AB$1203)>0),$C$2:$C$1203)/SUMIF($U$2:$U$1203,AE3,$C$2:$C$1203)

But this doesn't work and just gives me zero for everything.

If anyone could let me know how I do this that would be great.

Many thanks!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Re: Help with conditional SUMPRODUCT to also ignore blanks

The double negative in front of this bit:

--(U2:U1203=AE3)

is there to convert a TRUE/FALSE result into a 1 or 0 result. You need the double negative in front of your new TRUE/FALSE test.
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,375
Members
448,888
Latest member
Arle8907

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