multiple criteria with a hitch

jberwald

Board Regular
Joined
May 3, 2005
Messages
205
I need excel to calculate how many times this occurs:

That column C contains an X
when column H contains a certain name.

My problem is that column H can contain two names at times (ie John/Harry) and I would want this cell to be counted in both a John calculation and a Harry calculation.

I have tried this, but it only works on cells containing a single name

=SUMPRODUCT(--($C$3:$C211="X"),--($H3:$H211="John"))

Thanks in advance.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
a condition you can use for that is:

Code:
LEN(SUBSITUTE($H3:$H211,"John",""))<LEN($H3:$H211)

Rather than

$H3:$H211="John"

That way if "John" appears anywhere in the cell, it'll count it.

Edited to fix formula not showing up correctly.
 
Upvote 0
Hi,

try this
   C  D  E    F     G  H                      
 1       John Harry                           
 2       3    2                               
 3 x                   john                   
 4                     name                   
 5 x                   where does John live ? 
 6 x                   nothing here           
 7 x                   Garry                  
 8                     Harry                  
 9 x                                          
10 x                   Harry & John           
11 x                                          
12 x                   Harry                  

Blad1

[Table-It] version 06 by Erik Van Geit
Code:
RANGE   FORMULA (1st cell)
E2:F2   =SUMPRODUCT(--($C$3:$C$211="X"),--(ISNUMBER(SEARCH(E1,$H$3:$H$211))))

[Table-It] version 06 by Erik Van Geit

kind regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,543
Members
449,089
Latest member
davidcom

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