Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
EricE
 
Posts: n/a
Default Count rows that match 3 sets of criteria?



How do I count all the rows that match three sets of criteria? For example:
A B C
OM 1 1 1
OM2 3 6
BC 4 4
OM2 1 3
RR 2 2
BC 4 1

Say I want to count how many time OM 1 and OM2 appear with either a 1 or 4
in column B and when column C has a number that is between 1 and 5.

So far I can count all the times OM 1 and OM2 appear with a 1 and 4 in
column C by using this: =SUMPRODUCT(--ISNUMBER(MATCH(A1:A6,{"OM 1","OM
2"},0)),--ISNUMBER(MATCH(B1:B6,{1,4},0))). I was thinking that I could just
add something like --(C1:C6 =1),(C1:C6<=5) but that gives me a #value error.
I am also entering the formula with crtl-shift-enter. Can this even be done?
I imagine it can. Thanks in advance for any help anyone can provide.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Count rows that match 3 sets of criteria?

=SUMPRODUCT(--ISNUMBER(MATCH(A1:A6,{"OM 1","OM
2"},0)),--ISNUMBER(MATCH(B1:B6,{1,4},0)),--(C1:C6 =1),--(C1:C6<=5))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"EricE" wrote in message
...


How do I count all the rows that match three sets of criteria? For

example:
A B C
OM 1 1 1
OM2 3 6
BC 4 4
OM2 1 3
RR 2 2
BC 4 1

Say I want to count how many time OM 1 and OM2 appear with either a 1 or 4
in column B and when column C has a number that is between 1 and 5.

So far I can count all the times OM 1 and OM2 appear with a 1 and 4 in
column C by using this: =SUMPRODUCT(--ISNUMBER(MATCH(A1:A6,{"OM 1","OM
2"},0)),--ISNUMBER(MATCH(B1:B6,{1,4},0))). I was thinking that I could

just
add something like --(C1:C6 =1),(C1:C6<=5) but that gives me a #value

error.
I am also entering the formula with crtl-shift-enter. Can this even be

done?
I imagine it can. Thanks in advance for any help anyone can provide.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
EricE
 
Posts: n/a
Default Count rows that match 3 sets of criteria?



"Bob Phillips" wrote:

=SUMPRODUCT(--ISNUMBER(MATCH(A1:A6,{"OM 1","OM
2"},0)),--ISNUMBER(MATCH(B1:B6,{1,4},0)),--(C1:C6 =1),--(C1:C6<=5))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"EricE" wrote in message
...


How do I count all the rows that match three sets of criteria? For

example:
A B C
OM 1 1 1
OM2 3 6
BC 4 4
OM2 1 3
RR 2 2
BC 4 1

Say I want to count how many time OM 1 and OM2 appear with either a 1 or 4
in column B and when column C has a number that is between 1 and 5.

So far I can count all the times OM 1 and OM2 appear with a 1 and 4 in
column C by using this: =SUMPRODUCT(--ISNUMBER(MATCH(A1:A6,{"OM 1","OM
2"},0)),--ISNUMBER(MATCH(B1:B6,{1,4},0))). I was thinking that I could

just
add something like --(C1:C6 =1),(C1:C6<=5) but that gives me a #value

error.
I am also entering the formula with crtl-shift-enter. Can this even be

done?
I imagine it can. Thanks in advance for any help anyone can provide.



Perfect! Thanks Bob.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sloth
 
Posts: n/a
Default Count rows that match 3 sets of criteria?

=SUMPRODUCT((A1:A6="OM
1")+(A1:A6="OM2"),(B1:B6=1)+(B1:B6=4),(C1:C6=1)+( C1:C6<=5)-1)

The first is either one, the other or neither so it results in a 1, 1 or 0.
The last one is either one or both so it results in a 1 or 2 before the
subtraction of 1. And since they all include a mathematical operator the --
is not needed.

"EricE" wrote:



How do I count all the rows that match three sets of criteria? For example:
A B C
OM 1 1 1
OM2 3 6
BC 4 4
OM2 1 3
RR 2 2
BC 4 1

Say I want to count how many time OM 1 and OM2 appear with either a 1 or 4
in column B and when column C has a number that is between 1 and 5.

So far I can count all the times OM 1 and OM2 appear with a 1 and 4 in
column C by using this: =SUMPRODUCT(--ISNUMBER(MATCH(A1:A6,{"OM 1","OM
2"},0)),--ISNUMBER(MATCH(B1:B6,{1,4},0))). I was thinking that I could just
add something like --(C1:C6 =1),(C1:C6<=5) but that gives me a #value error.
I am also entering the formula with crtl-shift-enter. Can this even be done?
I imagine it can. Thanks in advance for any help anyone can provide.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I count the numbers of row that meet 2 criteria Debi Excel Worksheet Functions 4 November 10th 05 09:56 PM
Sum Count of Single Criteria in Multiple Non-Adjacent columns Sam via OfficeKB.com Excel Worksheet Functions 9 July 14th 05 10:01 PM
Getting Count field to recognise rows with negative values in Exc. hamish Excel Worksheet Functions 2 June 20th 05 05:06 AM
If two columns match then count one. How? Tried countif and sum . IMC Medrec Excel Worksheet Functions 1 February 14th 05 12:28 PM
Counting rows based on criteria in multiple cells Margaret Excel Discussion (Misc queries) 11 December 2nd 04 11:04 PM


All times are GMT +1. The time now is 05:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"