A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Counting independent items in a list



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2010, 06:28 PM posted to microsoft.public.excel.worksheet.functions
Brad E.
external usenet poster
 
Posts: 18
Default Counting independent items in a list

This formula is meant to count independent entries in A1:A20.
=ROUND(SUMPRODUCT(1/COUNTIF(A1:A20,A1:A20)),0)

Can anyone make this better? I am not talking about using Absolute
references, but ways to modify it so it works in every case. For instance,
at first I had an empty cell in my range and the #DIV/0 error was returned.
I don't fully understand the two negatives in front of some formulas, but I
am wondering if that would work better, too?
=ROUND(SUMPRODUCT(1/--COUNTIF(A1:A20,A1:A20)),0)

Thanks for any help.
-- Brad E.
  #2  
Old March 15th, 2010, 07:31 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Counting independent items in a list

Hi,

here's an alternative that ignores blanks

=SUMPRODUCT((A1:A20"")/COUNTIF(A1:A10,A1:A20&""))

the double unary (--) coerce true or false into one or zero but do nothing
in your formula.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Brad E." wrote:

This formula is meant to count independent entries in A1:A20.
=ROUND(SUMPRODUCT(1/COUNTIF(A1:A20,A1:A20)),0)

Can anyone make this better? I am not talking about using Absolute
references, but ways to modify it so it works in every case. For instance,
at first I had an empty cell in my range and the #DIV/0 error was returned.
I don't fully understand the two negatives in front of some formulas, but I
am wondering if that would work better, too?
=ROUND(SUMPRODUCT(1/--COUNTIF(A1:A20,A1:A20)),0)

Thanks for any help.
-- Brad E.

  #3  
Old March 15th, 2010, 07:36 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Counting independent items in a list

Hi,

I should have added there are other (better) ways to do this and Bernd P has
a well presented web page on how it should be done

http://www.sulprobil.com/html/count_unique.html

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Brad E." wrote:

This formula is meant to count independent entries in A1:A20.
=ROUND(SUMPRODUCT(1/COUNTIF(A1:A20,A1:A20)),0)

Can anyone make this better? I am not talking about using Absolute
references, but ways to modify it so it works in every case. For instance,
at first I had an empty cell in my range and the #DIV/0 error was returned.
I don't fully understand the two negatives in front of some formulas, but I
am wondering if that would work better, too?
=ROUND(SUMPRODUCT(1/--COUNTIF(A1:A20,A1:A20)),0)

Thanks for any help.
-- Brad E.

  #4  
Old March 15th, 2010, 07:39 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Counting independent items in a list

This is Bernd's webpage that i was looking for where he specifically comments
on the solution I gave you

http://www.sulprobil.com/html/excel_don_ts.html
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Brad E." wrote:

This formula is meant to count independent entries in A1:A20.
=ROUND(SUMPRODUCT(1/COUNTIF(A1:A20,A1:A20)),0)

Can anyone make this better? I am not talking about using Absolute
references, but ways to modify it so it works in every case. For instance,
at first I had an empty cell in my range and the #DIV/0 error was returned.
I don't fully understand the two negatives in front of some formulas, but I
am wondering if that would work better, too?
=ROUND(SUMPRODUCT(1/--COUNTIF(A1:A20,A1:A20)),0)

Thanks for any help.
-- Brad E.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.