Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Count Unique Values from a Subset of a List

Hi,

If I use the array formula bellow to count the unique values of a list
it works fine.

{=SUM(1/COUNTIF(C8:C11,C8:C11))}

But what I really need is the sum of unique values, of each subset of
the list.

A B
1 dog 1
2 dog 1
3 dog 3
4 dog 2
5 cat 1
6 cat 2

For example if I have the table above, the result that I want is the
sum of 3 different of dog subset elements plus 2 from cat subset.

Anyone can help me?

Thanks,

Ricardo
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 80
Default Count Unique Values from a Subset of a List

Like using sumif?

=SUMIF(A1:A8,"dog",B1:B8). The answer would be 7 using your numbers
above.

If dog and cat entries are in Column A and the numbers are in Column
B, this formula would give you the total in B for every entry of dog
in A.

Does that give you what you want?
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Count Unique Values from a Subset of a List

Assuming there are no empty/blank cells in your data range...

D1 = dog
D2 = cat

Enter this array formula** in E1 and copy down to E2:

=COUNT(1/FREQUENCY(IF(A$1:A$6=D1,MATCH(B$1:B$6,B$1:B$6,0)), ROW(B$1:B$6)-MIN(ROW(B$1:B$6))+1))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)


--
Biff
Microsoft Excel MVP


"Ricardo Dinis" wrote in message
...
Hi,

If I use the array formula bellow to count the unique values of a list
it works fine.

{=SUM(1/COUNTIF(C8:C11,C8:C11))}

But what I really need is the sum of unique values, of each subset of
the list.

A B
1 dog 1
2 dog 1
3 dog 3
4 dog 2
5 cat 1
6 cat 2

For example if I have the table above, the result that I want is the
sum of 3 different of dog subset elements plus 2 from cat subset.

Anyone can help me?

Thanks,

Ricardo



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Count Unique Values from a Subset of a List

On Jan 16, 10:11 pm, "T. Valko" wrote:
Assuming there are no empty/blank cells in your data range...

D1 = dog
D2 = cat

Enter this array formula** in E1 and copy down to E2:

=COUNT(1/FREQUENCY(IF(A$1:A$6=D1,MATCH(B$1:B$6,B$1:B$6,0)), ROW(B$1:B$6)-MIN(ROW(B$1:B$6))+1))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

--
Biff
Microsoft Excel MVP

"Ricardo Dinis" wrote in message

...

Hi,


If I use the array formula bellow to count the unique values of a list
it works fine.


{=SUM(1/COUNTIF(C8:C11,C8:C11))}


But what I really need is the sum of unique values, of each subset of
the list.


A B
1 dog 1
2 dog 1
3 dog 3
4 dog 2
5 cat 1
6 cat 2


For example if I have the table above, the result that I want is the
sum of 3 different of dog subset elements plus 2 from cat subset.


Anyone can help me?


Thanks,


Ricardo


Thanks a lot, It's does exactly what I'm looking for.

HKaplan, I dont want to sum dog elements, I was trying to count unique
values. Sorry my bad English if you don't understand.
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Count Unique Values from a Subset of a List

"Ricardo Dinis" wrote in message
...
On Jan 16, 10:11 pm, "T. Valko" wrote:
Assuming there are no empty/blank cells in your data range...

D1 = dog
D2 = cat

Enter this array formula** in E1 and copy down to E2:

=COUNT(1/FREQUENCY(IF(A$1:A$6=D1,MATCH(B$1:B$6,B$1:B$6,0)), ROW(B$1:B$6)-MIN(ROW(B$1:B$6))+1))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

--
Biff
Microsoft Excel MVP

"Ricardo Dinis" wrote in message

...

Hi,


If I use the array formula bellow to count the unique values of a list
it works fine.


{=SUM(1/COUNTIF(C8:C11,C8:C11))}


But what I really need is the sum of unique values, of each subset of
the list.


A B
1 dog 1
2 dog 1
3 dog 3
4 dog 2
5 cat 1
6 cat 2


For example if I have the table above, the result that I want is the
sum of 3 different of dog subset elements plus 2 from cat subset.


Anyone can help me?


Thanks,


Ricardo


Thanks a lot, It's does exactly what I'm looking for.

HKaplan, I dont want to sum dog elements, I was trying to count unique
values. Sorry my bad English if you don't understand.


You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Count Unique Values from a Subset of a List

Biff, would you mind explaining how this formula works? Evaluating it piece by piece provides some understanding but not 100%. Thanks!
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
Count Unique Values Averitt Engineer[_2_] Excel Worksheet Functions 17 February 17th 07 09:57 AM
Unique Count when Values 0.01 Jill1 Excel Worksheet Functions 3 November 22nd 06 01:36 PM
How to count unique values? Annie Excel Worksheet Functions 0 March 3rd 06 07:17 PM
Count unique values Mary Excel Worksheet Functions 3 January 20th 06 08:56 PM
Count unique values and create list based on these values vipa2000 Excel Worksheet Functions 7 August 5th 05 01:17 AM


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