#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Count unique values

Hi

In my Excel worksheet there are two columns A & B. A contains the product
codes and B contains the customer codes. How can I count the number of UNIQUE
customer for a particular product? Both formula or pivot table would be fine.

Col A Col B
Pen Customer 1
Ruler Customer 1
Pen Customer 2
Ruler Customer 1
Pen Customer 1
Pen Customer 3

Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Count unique values

Try the below array formula. Apply formula using 'Ctrl+Shift+Enter' instead
of 'Enter'

=SUM(IF(FREQUENCY(IF((B1:B10<"")*(A1:A10="Pen"),
MATCH(B1:B10,B1:B10,0)),ROW(A1:A10)-ROW(A1)+1),1))

--
Jacob


"Natalie Lau" wrote:

Hi

In my Excel worksheet there are two columns A & B. A contains the product
codes and B contains the customer codes. How can I count the number of UNIQUE
customer for a particular product? Both formula or pivot table would be fine.

Col A Col B
Pen Customer 1
Ruler Customer 1
Pen Customer 2
Ruler Customer 1
Pen Customer 1
Pen Customer 3

Thanks in advance!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 806
Default Count unique values

Hello Nathalie,

I suggest to select a sufficiently long range with two columns and to
array-enter:
=Pfreq(A1:A999,B1:B999)
[Enter with CTRL + SHIFT + ENTER, not only with ENTER.]

Pfreq is a user-defined function:
http://sulprobil.com/html/pfreq.html

Press ALT + F11, enter a new module, copy my function (macro text)
into the new module, go back to your worksheet and the formula
mentioned above will work.

Regards,
Bernd
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Count unique values

It works! Thank you!

Why using "Ctrl+Shift+Enter" instead of "Enter" please?
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Count unique values

This is an array formula. An array formula can perform multiple calculations
and then return either a single result or multiple results. Array formulas
act on two or more sets of values known as array arguments. Each array
argument must have the same number of rows and columns. You create array
formulas in the same way that you create other formulas, except you press
CTRL+SHIFT+ENTER to enter the formula. If successful in 'Formula Bar' you can
notice the curly braces at both ends like "{=<formula}"

--
Jacob


"Natalie Lau" wrote:

It works! Thank you!

Why using "Ctrl+Shift+Enter" instead of "Enter" please?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 561
Default Count unique values

Try a little shorter Array_Formula:
http://img51.imageshack.us/img51/4248/nonamef.png
Micky



"Natalie Lau" wrote:

Hi

In my Excel worksheet there are two columns A & B. A contains the product
codes and B contains the customer codes. How can I count the number of UNIQUE
customer for a particular product? Both formula or pivot table would be fine.

Col A Col B
Pen Customer 1
Ruler Customer 1
Pen Customer 2
Ruler Customer 1
Pen Customer 1
Pen Customer 3

Thanks in advance!

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 but not Filtered or Hidden Values Lee Excel Worksheet Functions 3 June 2nd 09 11:18 PM
count unique values, if ... Averitt Engineer[_2_] Excel Worksheet Functions 2 February 15th 07 06:41 PM
How to count unique values? Annie Excel Worksheet Functions 0 March 3rd 06 07:17 PM
Count unique values and create list based on these values vipa2000 Excel Worksheet Functions 7 August 5th 05 01:17 AM
Count Unique Values annie Excel Worksheet Functions 1 June 9th 05 07:19 AM


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