Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
KB
 
Posts: n/a
Default How does this formula work

To count unique records, =sum(1/countif(a2:a100,a2:100)) entered as an array
formula works great except when range contains blanks. Please explain how
this works, I don't understand it
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Countif(A2:A100,A2:A100) returns an array of 100 counts of the values in
A2:A100, with unique values returning 1 and replicated values returning
the count of replicates the number of times replicated. E.g.,
{1,2,3,4,2,5} would return {1,2,1,1,2,1}.

1/x inverts the array (e.g., {1,0.5,1,1,0.5,1}) so that each replicate
is only counted it's proportional number of times, and the array is then
summed.




In article ,
"KB" wrote:

To count unique records, =sum(1/countif(a2:a100,a2:100)) entered as an array
formula works great except when range contains blanks. Please explain how
this works, I don't understand it

  #3   Report Post  
KB
 
Posts: n/a
Default

Understood, thanks!

"JE McGimpsey" wrote:

Countif(A2:A100,A2:A100) returns an array of 100 counts of the values in
A2:A100, with unique values returning 1 and replicated values returning
the count of replicates the number of times replicated. E.g.,
{1,2,3,4,2,5} would return {1,2,1,1,2,1}.

1/x inverts the array (e.g., {1,0.5,1,1,0.5,1}) so that each replicate
is only counted it's proportional number of times, and the array is then
summed.




In article ,
"KB" wrote:

To count unique records, =sum(1/countif(a2:a100,a2:100)) entered as an array
formula works great except when range contains blanks. Please explain how
this works, I don't understand it


  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

To take care of the blanks, use

=SUM((A2:A100<"")/COUNTIF(A2:A100,A2:A100&""))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KB" wrote in message
...
Understood, thanks!

"JE McGimpsey" wrote:

Countif(A2:A100,A2:A100) returns an array of 100 counts of the values in
A2:A100, with unique values returning 1 and replicated values returning
the count of replicates the number of times replicated. E.g.,
{1,2,3,4,2,5} would return {1,2,1,1,2,1}.

1/x inverts the array (e.g., {1,0.5,1,1,0.5,1}) so that each replicate
is only counted it's proportional number of times, and the array is then
summed.




In article ,
"KB" wrote:

To count unique records, =sum(1/countif(a2:a100,a2:100)) entered as

an array
formula works great except when range contains blanks. Please explain

how
this works, I don't understand it




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
Howdo U copy a formula down a column, that uses data in another w. Need Help pasting a formula Excel Worksheet Functions 1 February 25th 05 06:04 PM
Problem with VBA returning the contents of a long formula. [email protected] Excel Discussion (Misc queries) 2 February 23rd 05 12:14 AM
Polynimial trandline formula CLR Charts and Charting in Excel 9 February 7th 05 07:31 PM
formula won't work tink13ub Excel Worksheet Functions 1 January 17th 05 06:59 AM
formula won't work Linette Excel Worksheet Functions 0 January 17th 05 06:05 AM


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