Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
giantwolf
 
Posts: n/a
Default Counting Distinct Values


Hi,

Hope you all had a good Christmas. Is there a way to count the number
of distinct values that appear in a column either by a formula or
macro?

ie. in this list it would return the value 4 as orange appears twice so
should only be counted once.

apple
orange
pear
orange
grape

Thanks in advance,

GW


--
giantwolf
------------------------------------------------------------------------
giantwolf's Profile: http://www.excelforum.com/member.php...o&userid=24718
View this thread: http://www.excelforum.com/showthread...hreadid=496644

  #2   Report Post  
Posted to microsoft.public.excel.misc
SteveG
 
Posts: n/a
Default Counting Distinct Values


This should work for you.


=SUMPRODUCT((A20:A25<"")/COUNTIF(A20:A25,A20:A25&""))

Where A20:A25 is your range of data.

Cheers,

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=496644

  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default Counting Distinct Values

Visit Chip's page www.cpearson.com
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"giantwolf" wrote
in message ...

Hi,

Hope you all had a good Christmas. Is there a way to count the number
of distinct values that appear in a column either by a formula or
macro?

ie. in this list it would return the value 4 as orange appears twice so
should only be counted once.

apple
orange
pear
orange
grape

Thanks in advance,

GW


--
giantwolf
------------------------------------------------------------------------
giantwolf's Profile:
http://www.excelforum.com/member.php...o&userid=24718
View this thread: http://www.excelforum.com/showthread...hreadid=496644



  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Counting Distinct Values

one way:

=SUMPRODUCT((A1:A99<"")/COUNTIF(A1:A99,A1:A99&""))

(adjust the range to match, but don't use the whole column)

giantwolf wrote:

Hi,

Hope you all had a good Christmas. Is there a way to count the number
of distinct values that appear in a column either by a formula or
macro?

ie. in this list it would return the value 4 as orange appears twice so
should only be counted once.

apple
orange
pear
orange
grape

Thanks in advance,

GW

--
giantwolf
------------------------------------------------------------------------
giantwolf's Profile: http://www.excelforum.com/member.php...o&userid=24718
View this thread: http://www.excelforum.com/showthread...hreadid=496644


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
giantwolf
 
Posts: n/a
Default Counting Distinct Values


Thanks guys, the sumproduct/countif formula worked perfectly. Much
appreciated.

Have a good New Year,

GW


--
giantwolf
------------------------------------------------------------------------
giantwolf's Profile: http://www.excelforum.com/member.php...o&userid=24718
View this thread: http://www.excelforum.com/showthread...hreadid=496644

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
Group values Remote Desktop Connection hotkey Excel Worksheet Functions 5 October 2nd 05 05:01 AM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM
If Then, not using values, or not counting blanks Need Help 123 Excel Worksheet Functions 8 July 20th 05 06:23 PM
Counting Values Adam1 Chicago Excel Discussion (Misc queries) 4 January 7th 05 07:39 PM
Counting values Adam1 Chicago Excel Worksheet Functions 9 December 21st 04 03:36 PM


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