Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default Formula Question - please help

Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Formula Question - please help

On Jan 29, 4:33 pm, Belle wrote:
I need a formula that returns the number of unique times
an item appears in a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above


If the data are sorted, as in your example, and if you can ensure that
the last row ("Stamp" above) is followed by something else (like an
empty cell), the following might work for you:

=SUMPRODUCT(--(A1:A5<A2:A6))


----- original posting -----

On Jan 29, 4:33*pm, Belle wrote:
Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency *formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 964
Default Formula Question - please help

You could try:

=SUMPRODUCT((A1:A5<"")/COUNTIF(A1:A5,A1:A5))

HTH
Elkar


"Belle" wrote:

Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Formula Question - please help

Try this array* formula on your example:

=SUM(IF(LEN(A1:A10),1/COUNTIF(A1:A10,A1:A10)))

Assumes a data range of A1 to A10 - adjust as necessary.

*An array formula needs to be committed using the key combination of
Ctrl-Shift-Enter (CSE) rather than the usual Enter. If you do this
correctly then Excel will wrap curly braces around that formula when
viewed in the formula bar - do not type these yourself. If you edit/
amend the formula you need to use CSE again.

Hope this helps.

Pete


On Jan 30, 12:33*am, Belle wrote:
Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency *formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default Formula Question - please help

Thanks Pete - this seems to have worked! Thanks a lot!

"Pete_UK" wrote:

Try this array* formula on your example:

=SUM(IF(LEN(A1:A10),1/COUNTIF(A1:A10,A1:A10)))

Assumes a data range of A1 to A10 - adjust as necessary.

*An array formula needs to be committed using the key combination of
Ctrl-Shift-Enter (CSE) rather than the usual Enter. If you do this
correctly then Excel will wrap curly braces around that formula when
viewed in the formula bar - do not type these yourself. If you edit/
amend the formula you need to use CSE again.

Hope this helps.

Pete


On Jan 30, 12:33 am, Belle wrote:
Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Formula Question - please help

On Thu, 29 Jan 2009 16:33:02 -0800, Belle
wrote:

Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.



If you are counting blanks, try:

=SUMPRODUCT(1/COUNTIF(A1:A5,A1:A5&""))

If you want to ignore blanks, then try:

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

--ron
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Formula Question - please help

Hi,

You can try using this array formula (Ctrl+Shift+Enter)

=SUM(1/COUNTIF(range,range))

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Belle" wrote in message
...
Hi All,

I need a formula that returns the number of unique times an item appears
in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Formula Question - please help

You're welcome, but many of the other suggestions are very similar.

Pete

On Jan 30, 1:12*am, Belle wrote:
Thanks Pete - this seems to have worked! Thanks a lot!


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 144
Default Formula Question - please help

Hi
Try this non array formula
=SUMPRODUCT(1/COUNTIF(A1:A7,A1:A7))

This assume that there're no blank
Cells in the data table

However, if you have a large dataset,
Array formula and this Sumproduct formula
will slow down Excel
Pivot table will be your best solution

HTH

--
Your feedback is very much appreciate, pls click on the Yes button below if
this posting is helpful.

Thank You

cheers, francis









"Belle" wrote:

Hi All,

I need a formula that returns the number of unique times an item appears in
a text list.
Example List:
Pen
Pen
Pencil
Pencil
Stamp

I would a formula that returns 3 for the above (even though there are
multiples I only need to know the number of times something occurs).

I know I can do this with filters but this is not how I want to do it. I
also tried the Sum IF Frequency formula but couldn't seem to get that to
work.

Thanks in advance for your help.

Belle.

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
formula question JaneSmith Excel Worksheet Functions 2 June 18th 08 05:22 PM
If Formula Question ScottishSteve Excel Discussion (Misc queries) 4 March 11th 08 11:22 AM
what IF - formula question Rasoul Khoshravan Excel Worksheet Functions 4 October 13th 06 07:02 PM
Formula Question dramajuana Excel Discussion (Misc queries) 6 July 21st 06 11:41 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM


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