If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Excel, countif, multiple columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-02-08, 06:17
Karen Day Karen Day is offline
Registered User
 
Join Date: May 2002
Posts: 147
Excel, countif, multiple columns

Hi there,

I have say 3 columns of data in an excel spread sheet.

Column A = Multiple Names
Column B = MO, VOL, FWD
Column C = Mr, Mrs, Ms, Miss

So
Column A Column B Column C
John Doe MO Mr
Mary Smith Vol Ms
Lucy Richardo Mo Mrs
William Shatner FWD Mr
John Smith MO Mr
etc

I want to count column C only counting MR if Column B has MO in it.

So in the above example I would end up with a count of 2.

Can anyone help me with this?

thanks heaps in advance for any assistance.

Regards
Karen
Reply With Quote
  #2 (permalink)  
Old 07-02-08, 09:45
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Multi-condition count is accomplished with SUMPRODUCT

=SUMPRODUCT(($B$2:$B$100="MO")*($C$2:$C$100="MR"))

Notice that you cannot refer to the entire column, and all conditions must refer to the same length range.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 07-02-08, 10:40
Karen Day Karen Day is offline
Registered User
 
Join Date: May 2002
Posts: 147
Thank you so much - works perfectly
regards
Karen
Reply With Quote
  #4 (permalink)  
Old 10-28-08, 08:54
Tbug2 Tbug2 is offline
Registered User
 
Join Date: Oct 2008
Location: Northwest Indiana
Posts: 3
Thanks from me, too. I couldn't figure out how to make countif work for this situation, either. Sometimes slow and old is better, take's one to know one!
Reply With Quote
  #5 (permalink)  
Old 10-28-08, 14:35
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Glad that it helped.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #6 (permalink)  
Old 04-27-09, 07:31
ExpIorer ExpIorer is offline
Registered User
 
Join Date: Apr 2009
Posts: 1
Lightbulb too slow

If you need instant results on large tables these methods will be too slow (50 sumproducts took 2 seconds to my 1000 row table after each update).
My approach (takes just milliseconds in my case) is to create new column where you concatenate B and C columns and then use countif(newcolumn;"MrMO")

Last edited by ExpIorer; 04-27-09 at 07:42.
Reply With Quote
  #7 (permalink)  
Old 08-26-11, 13:59
sthoma6 sthoma6 is offline
Registered User
 
Join Date: Aug 2011
Posts: 1
Expanding on More than one column for Countif

I have a similar situation:

I have several state abbreviations in 1 column and rankings in another and need to come up with a formula so I do not have to count all combinations for each state

Ex:

AZ -3
AZ -3
AZ -2
AZ -1
AZ 4
AZ 4

etc. Since I have to do this for each state, I wanted to have a static field that I can enter which state I want and then my data is populated by score:

EX:

AZ -3 2
-2 1
-1 1
4 2

Thank you in advance!
Reply With Quote
  #8 (permalink)  
Old 09-04-11, 09:15
Karen Day Karen Day is offline
Registered User
 
Join Date: May 2002
Posts: 147
Did you get an answer on this?

Did you get an answer on this?
Do you still need help?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On