Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default SUMPRODUCT to calculate unique occurences of string in column of d

I have:
A1 = "A"
A2 = "A"
A3 = "B"
A4= "C"
A5= "A"

and

B1= "Apples"
B2= "Pears"
B3= "Strawberries"
B4= "Pears"
B5= "Apples"

I want to calculate the following:

For all the occurences of "A" in Column A, I want to count the uniquely
different TYPES of values that are contained in column B.

E.g. in the example above, the answer will be "2", because there are 3 x
occurences of "A" in column A, and these 3 occurences related to 2 occurences
of "Apples" and 1 of "Pears", thus 2 unique strings of data.

Please help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 265
Default SUMPRODUCT to calculate unique occurences of string in column of d

Try the following formula, which needs to be confirmed with
CONTROL+SHIFT+ENTER, not just ENTER...

=SUM(IF(FREQUENCY(IF(A1:A5="A",IF(B1:B5<"",MATCH( "~"&B1:B5,B1:B5&"",0)))
,ROW(B1:B5)-ROW(B1)+1),1))

Hope this helps!

http://www.xl-central.com

In article ,
WildWill wrote:

I have:
A1 = "A"
A2 = "A"
A3 = "B"
A4= "C"
A5= "A"

and

B1= "Apples"
B2= "Pears"
B3= "Strawberries"
B4= "Pears"
B5= "Apples"

I want to calculate the following:

For all the occurences of "A" in Column A, I want to count the uniquely
different TYPES of values that are contained in column B.

E.g. in the example above, the answer will be "2", because there are 3 x
occurences of "A" in column A, and these 3 occurences related to 2 occurences
of "Apples" and 1 of "Pears", thus 2 unique strings of data.

Please help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default SUMPRODUCT to calculate unique occurences of string in column of d

Try this:

=ROUND(SUMPRODUCT(--(A1:A5="A"),1/COUNTIF(B1:B5,B1:B5&"")),0)

HTH
Elkar


"WildWill" wrote:

I have:
A1 = "A"
A2 = "A"
A3 = "B"
A4= "C"
A5= "A"

and

B1= "Apples"
B2= "Pears"
B3= "Strawberries"
B4= "Pears"
B5= "Apples"

I want to calculate the following:

For all the occurences of "A" in Column A, I want to count the uniquely
different TYPES of values that are contained in column B.

E.g. in the example above, the answer will be "2", because there are 3 x
occurences of "A" in column A, and these 3 occurences related to 2 occurences
of "Apples" and 1 of "Pears", thus 2 unique strings of data.

Please help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 265
Default SUMPRODUCT to calculate unique occurences of string in column of d

This formula may not return the desired result in some circumstances.
For example, if A1:B5 contains the following data...

A Apples
A Pears
B Pears
C Pears
A Apples

....the formula will return 1, instead of 2, which is the desired result.

Hope this helps!

http://www.xl-central.com

In article ,
Elkar wrote:

Try this:

=ROUND(SUMPRODUCT(--(A1:A5="A"),1/COUNTIF(B1:B5,B1:B5&"")),0)

HTH
Elkar


"WildWill" wrote:

I have:
A1 = "A"
A2 = "A"
A3 = "B"
A4= "C"
A5= "A"

and

B1= "Apples"
B2= "Pears"
B3= "Strawberries"
B4= "Pears"
B5= "Apples"

I want to calculate the following:

For all the occurences of "A" in Column A, I want to count the uniquely
different TYPES of values that are contained in column B.

E.g. in the example above, the answer will be "2", because there are 3 x
occurences of "A" in column A, and these 3 occurences related to 2
occurences
of "Apples" and 1 of "Pears", thus 2 unique strings of data.

Please help.

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 # of unique occurences of a text in a column? Rob Kaiser Excel Worksheet Functions 10 November 21st 07 09:16 PM
Count Unique Occurences Sean Excel Worksheet Functions 4 March 19th 07 11:52 AM
unique occurences in list Chandler Excel Worksheet Functions 2 May 2nd 05 02:06 PM
unique occurences in list Chandler Excel Worksheet Functions 3 May 2nd 05 02:06 PM
Counting every unique text string in a column doctor rick Excel Worksheet Functions 2 December 15th 04 07:36 AM


All times are GMT +1. The time now is 12:38 PM.

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

About Us

"It's about Microsoft Excel"