View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Biff Biff is offline
external usenet poster
 
Posts: 1,688
Default Second most frequent number in a data set in Excel?

Hmmm....

Is this the unsolvable problem?

Having tried the examples in the links, Bernie's doesn't handle duplicates,
Peo's will only work for the 2nd mode, RD's doesn't handle duplicates, Ron's
doesn't handle duplicates, my attempt also didn't handle duplicates.
Harlan's does handle the duplicates but it needs a trap, otherwise, after
the last unique value is returned the formula starts "randomly" repeating
until it's been copied to more rows than the indexed range. (at which point
it errors as it should)

Harlan's formula with a trap:

=IF(ROWS($1:1)<=SUMPRODUCT((rng<"")/COUNTIF(rng,rng&"")),INDEX(rng,MATCH(LARGE(FREQUEN CY(rng,rng)+(1-ROW(INDIRECT("1:"&(ROWS(rng)+1)))/(ROWS(rng)+1)),ROW(A1)),FREQUENCY(rng,rng)+(1-ROW(INDIRECT("1:"&(ROWS(rng)+1)))/(ROWS(rng)+1)),0)),"")

See the link regarding some strange behavior of
SUMPRODUCT((rng<"")/COUNTIF(rng,rng&"")):

http://tinyurl.com/jaen9

Biff

"Mr Grim" <Mr wrote in message
...
I am trying to find the second most frequently occuring value in a given
data
set. I know MODE will give most frequent value but I need second, third,
fourth, and fifth most frequent values.