Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Watercolor artist
 
Posts: n/a
Default A counting formula that won't count multiple instances of same val

I need a formula that will count all the different instances of a value in a
column. For example, in the example below, the count would be 3 because, "1,"
though it occurs thrice, will only be counted once.

Col A
1
1
2
3
1

Thanks in advance,
Howard
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

one way:

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

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

Watercolor artist wrote:

I need a formula that will count all the different instances of a value in a
column. For example, in the example below, the count would be 3 because, "1,"
though it occurs thrice, will only be counted once.

Col A
1
1
2
3
1

Thanks in advance,
Howard


--

Dave Peterson
  #3   Report Post  
RagDyer
 
Posts: n/a
Default

Try this:

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

This should work even though you might have blank cells in the range.
--
HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================



"Watercolor artist" wrote in
message ...
I need a formula that will count all the different instances of a value in

a
column. For example, in the example below, the count would be 3 because,

"1,"
though it occurs thrice, will only be counted once.

Col A
1
1
2
3
1

Thanks in advance,
Howard


  #4   Report Post  
BorisS
 
Posts: n/a
Default

can you quickly explain what this is doing? Just curious what the formula's
logic is.
--
Boris


"Dave Peterson" wrote:

one way:

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

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

Watercolor artist wrote:

I need a formula that will count all the different instances of a value in a
column. For example, in the example below, the count would be 3 because, "1,"
though it occurs thrice, will only be counted once.

Col A
1
1
2
3
1

Thanks in advance,
Howard


--

Dave Peterson

  #5   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Try this quick and easy experiment....

Enter these values and formulas in the designated cells:

A1 = 20
A2 = 20
A3 = 1
A4 = 2

Enter this formula in B1 and copy down to B4:

=(A1<"")*1

Enter this formula in C1 and copy down to C4:

=COUNTIF(A$1:A$4,A1)

Enter this formula in D1 and copy down to D4:

=B1/C1

And finally:

=SUM(D1:D4)

Notice the &"" in the Countif function:

COUNTIF(A1:A4,A1:A4&"")

What that does is during the calculation process it appends a null string to
the array of values in A1:A4. If there was an empty cell in that range
without the &"" the formula would return a division error. Try clearing one
of the cells, A1:A4, and see what happens. So, if a cell is empty, the null
string gets "placed" in that element of the array to prevent the error from
occuring.

Biff

"BorisS" wrote in message
...
can you quickly explain what this is doing? Just curious what the
formula's
logic is.
--
Boris


"Dave Peterson" wrote:

one way:

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

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

Watercolor artist wrote:

I need a formula that will count all the different instances of a value
in a
column. For example, in the example below, the count would be 3
because, "1,"
though it occurs thrice, will only be counted once.

Col A
1
1
2
3
1

Thanks in advance,
Howard


--

Dave Peterson





  #6   Report Post  
Watercolor artist
 
Posts: n/a
Default

Thanks Dave. It does exactly what I need.

Howard

"Dave Peterson" wrote:

one way:

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

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

Watercolor artist wrote:

I need a formula that will count all the different instances of a value in a
column. For example, in the example below, the count would be 3 because, "1,"
though it occurs thrice, will only be counted once.

Col A
1
1
2
3
1

Thanks in advance,
Howard


--

Dave Peterson

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
SUMPRODUCT Formula to Count Row of data Below Matched Criteria Sam via OfficeKB.com Excel Worksheet Functions 8 February 3rd 05 01:37 AM
Counting "rows", i.e. simultaneous criteria for multiple cells gkline Excel Worksheet Functions 2 November 19th 04 07:30 AM
Group by count formula nobrabbit Excel Worksheet Functions 1 November 7th 04 09:10 PM
Count If Formula Mimi Excel Worksheet Functions 0 November 5th 04 11:55 AM
Count rows based on multiple criteria Murph Excel Worksheet Functions 1 October 28th 04 07:13 AM


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