Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tim C
 
Posts: n/a
Default Count of unique items meeting condition

Excel 2003 on Windows XP.

Sheet1
A1:A10, named Category, contains "A", "B" or "C".
B1:B10, named Code, contains a code number as text. Items are not unique.

Sample data:

A 1-1
A 1-1
A 1-2
A 1-2
B 1-1
B 1-2
B 1-3
C 1-1
C 1-1
C 1-1
C 1-1

Sheet2
Column A contains the possible categories.
In column B, I need a formula that will give me a count of unique codes for
a given category.

Sample desired result:

A 2
B 3
C 1

Unique I can do. Unique with conditions, I can't figure out. Any help is
greatly appreciated.

Thanks,
Tim C


  #2   Report Post  
Daniel.M
 
Posts: n/a
Default

Hi Tim,

By using a match(). you always generating the same 'number' (the first match)
for any condition satisfying the criteria you supplied. By using frequency, you
distribute the matches into buckets (from 1 to .Rows.Count).
You then have as many 'unique' occurences as there are different match results
different than 0.

Assuming your letter in E1 ("A", "B" or "C"), this array (Ctrl-Shift-Enter)
formula:

=SUM(--(FREQUENCY(IF(Category=E1,MATCH(Codes,Codes,0)),RO W(INDIRECT("1:"&ROWS(Co
des))))0))

or this one (same idea, but here the 0 will produce #DIV0! errors that won't be
COUNTed. It's slightly shorter but not faster)

=COUNT(1/FREQUENCY(IF(Category=E1,MATCH(Codes,Codes,0)),ROW (INDIRECT("1:"&ROWS(C
odes)))))

Regards,

Daniel M.

"Tim C" wrote in message
...
Excel 2003 on Windows XP.

Sheet1
A1:A10, named Category, contains "A", "B" or "C".
B1:B10, named Code, contains a code number as text. Items are not unique.

Sample data:

A 1-1
A 1-1
A 1-2
A 1-2
B 1-1
B 1-2
B 1-3
C 1-1
C 1-1
C 1-1
C 1-1

Sheet2
Column A contains the possible categories.
In column B, I need a formula that will give me a count of unique codes for
a given category.

Sample desired result:

A 2
B 3
C 1

Unique I can do. Unique with conditions, I can't figure out. Any help is
greatly appreciated.

Thanks,
Tim C




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
Find Count of Items with certain criteria Tucson Guy Excel Discussion (Misc queries) 3 January 1st 05 02:11 PM


All times are GMT +1. The time now is 11:09 PM.

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"