Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Oggie Ben Doggie
 
Posts: n/a
Default countif, multiple criteria...

I have a table like this:
(sorry if the message mangles it, but there are tabs so you can paste
it correctly if you need to... I think)

Store Category Item
A 1 blahblah
A 1 blahblah
B 1 blahblah
B 1 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
B 2 blahblah
A 3 blahblah
B 3 blahblah
C 3 blahblah

I'd like to use a countif formula to generate the occurrences column.
Ideas?

Results
Location Category Number of Occurrences
A 1 2
2 5
3 1
B 1 2
2 1
3 1
C 1 0
2 0
3 1

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary L Brown
 
Posts: n/a
Default countif, multiple criteria...

SumProduct should do it. Here are some notes I have on it's use. [your
specific example should leave out the 3rd array in the SumProduct formula.

'/-----------------------------------------------------------/
'DATA:
' A B C
'1 Start stop projection
'2 0 78 1
'3 79 200 2
'4 201 500 3
'5 501 1000 4
'/-----------------------------------------------------------/
'FORMULAS:
' A B
' 7 Score Projection using SumProduct formula
' 8 400 3 =SUMPRODUCT(--(A8=A2:A5),--(A8<=B2:B5),--(C2:C5))
' 9 15 1 =SUMPRODUCT(--(A8=A2:A5),--(A8<=B2:B5),--(C2:C5))
'10 799 4 =SUMPRODUCT(--(A10=A2:A5),--(A10<=B2:B5),--(C2:C5))
'11 82 2 =SUMPRODUCT(--(A11=A2:A5),--(A11<=B2:B5),--(C2:C5))
'/-----------------------------------------------------------/

'SumProduct muliplies the 1st array * 2nd array * 3rd array * etc
' and then adds the products
'
'FALSE = 0 / TRUE = 1
'
'In the DATA above, SumProduct evaluates the 400 in Cell A8 as
'FALSE * FALSE * 1
'FALSE * FALSE * 2
'TRUE * TRUE * 3
'FALSE * FALSE * 4
'
'OR
'
' 0 * 0 * 1 = 0
' 0 * 0 * 2 = 0
' 1 * 1 * 3 = 3
' 0 * 0 * 4 = 0
' ---
' 3
' ===
'/-----------------------------------------------------------/
'NOTES:
' The double dash "--" is used because you may be summing a range
'that could contain non-numeric text or Booleans. This will coerce
'the returns to 0 or 1. Otherwise, #VALUE! may be returned.
'/-----------------------------------------------------------/


HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Oggie Ben Doggie" wrote:

I have a table like this:
(sorry if the message mangles it, but there are tabs so you can paste
it correctly if you need to... I think)

Store Category Item
A 1 blahblah
A 1 blahblah
B 1 blahblah
B 1 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
B 2 blahblah
A 3 blahblah
B 3 blahblah
C 3 blahblah

I'd like to use a countif formula to generate the occurrences column.
Ideas?

Results
Location Category Number of Occurrences
A 1 2
2 5
3 1
B 1 2
2 1
3 1
C 1 0
2 0
3 1


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Duke Carey
 
Posts: n/a
Default countif, multiple criteria...

If you want the result formatted as shown, use a Pivot table. Generate it by
selecting it from the Data menu and following the prompts.

Otherwise you can use a formula to count the occurrences (assumes 'Store' is
in A1 and 'Category' is in B1)

=sumproduct(--(a2:a1000="A") , --(B2:b1000=1))

Change the ="A" and the =1 to reflect your actual values



"Oggie Ben Doggie" wrote:

I have a table like this:
(sorry if the message mangles it, but there are tabs so you can paste
it correctly if you need to... I think)

Store Category Item
A 1 blahblah
A 1 blahblah
B 1 blahblah
B 1 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
A 2 blahblah
B 2 blahblah
A 3 blahblah
B 3 blahblah
C 3 blahblah

I'd like to use a countif formula to generate the occurrences column.
Ideas?

Results
Location Category Number of Occurrences
A 1 2
2 5
3 1
B 1 2
2 1
3 1
C 1 0
2 0
3 1


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
Using Countif with multiple criteria in the same column. Harley Excel Discussion (Misc queries) 5 May 5th 23 07:44 PM
countif using multiple criteria Wayne E Excel Discussion (Misc queries) 4 January 19th 06 03:11 AM
COUNTIF or SUM function (Multiple criteria) HELP!! Australia Excel Worksheet Functions 3 September 19th 05 07:39 AM
countif function with multiple criteria Geoff Excel Discussion (Misc queries) 1 August 11th 05 11:50 PM
Countif w/ Multiple Criteria Patrick_KC Excel Worksheet Functions 2 August 9th 05 09:25 PM


All times are GMT +1. The time now is 12:36 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"