COUNT in either or A or B but not a total -

NICKRENN

New Member
Joined
Sep 6, 2017
Messages
22
Hi

I'm trying to count the number of families with a school age child. So i have a column A for boys over 5 under 15 and Column B girls over 5 under 15.

I don't want to manually add in a column that does a calculation to the data set, but i need to know the number of families who have a school age child. Either an entry in column A or B or Both.

So if there are 4 families with boys and 3 with girls - normally count function would return 7 but one of the families has a girl and a boy so the answer i'm looking for is 6.

Is it possible to use count for this? or do i need something else?

Thanks

Nick
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try like this

=SUMPRODUCT((A2:A100+B2:B100>0)+0)


Thats giving me a #Value error - i've reformatted the cells from General to number and still same error.

my actual formula now reads like this:

=SUMPRODUCT(('HH MSNA'!AH2:AH1000+'HH MSNA'!AI2:AI1000>0)+0)

but i only have data in up to row 30 for this sample.

any ideas?

thanks
 
Upvote 0
Hi,

If the cells conatin text you can try this : (change range as needed)

=SUMPRODUCT(1/(COUNTIF($A$2:$B$10,$A$2:$B$10)),--($A$2:$B$10=A2:B10))
 
Upvote 0
Ignore me, i found a cell with text i had missed, that works perfectly now.

thanks so much for your help.

nick
 
Upvote 0
What exactly is in columns A and B? If it's the names, try something like this:

=SUMPRODUCT((('HH MSNA'!AH2:AH1000<>"")+('HH MSNA'!AI2:AI1000<>"")>0)+0)
 
Upvote 0

Forum statistics

Threads
1,226,729
Messages
6,192,696
Members
453,747
Latest member
tylerhyatt04

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