SUMPRODUCT using AND + OR

WildWill

Board Regular
Joined
Sep 10, 2009
Messages
92
Hi

I a table of data (A1:K50), I want to count all occurences where A1:50 = Not Empty AND (F1:50) = Not Empty OR G1:50 = Not Empty OR H1:50 = Not Empty.

I was thinking of using a SUMPRODUCT but not sure how I would indicate the above combinations in it?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi

Your expression is not clear, since you did not use parentheses.

You posted

A And B Or C Or d

With the usual order of precedence this would mean

(A And B) Or C Or d

Is this correct?
 
Upvote 0
Hi

Your expression is not clear, since you did not use parentheses.

You posted

A And B Or C Or d

With the usual order of precedence this would mean

(A And B) Or C Or d

Is this correct?

Sorry about that. Yes, your interpretation is correct.
 
Upvote 0
Just beat me to it

=SUMPRODUCT(($A$1:$A$5<>"")*($F$1:$F$5<>""))+(($G$1:$G$5<>"")+($H$1:$H$5<>""))

pgc01 why the start and end bits??
 
Upvote 0
pgc01 why the start and end bits??

Hi Martin

The start and end bits are necessary because you don't want to double count rows.

For ex., let's say that in row 5 both G5 and H5 are not empty. In that case with your expression you'll be adding 2 instead of 1. If also A5 and F5 are not empty you'll add 3.

Since in my case I compare the result of your expression with 0, I'll always add 1, no matter if the result of the expression is 1, 2 or 3.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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