View Single Post
  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

Saadi wrote...
....
Suppose I have data in State filed like this in G Column

G
State
CA
CA
FL
GA
GA
CO
CA
FL
IL
FL
WA
FL


I'll assume the data is in a range named StateData.

Now I want to Show top 3 states in column G30, and H30 automatically.

e.g.

FL 4
CA 3
GA 2

....

If you want to do this in just 6 cells, G30:H32, with no other cells
holding intermediate calculations (using more cells actually improves
recalc speed), then enter the following formulas

G30:
=INDEX(StateData,MODE(MATCH(StateData,StateData,0) ))

G31: [array formula]
=INDEX(StateData,MODE(IF(COUNTIF(G$30:G30,StateDat a)=0,
MATCH(StateData,StateData,0))))

and fill G31 into G32,
H30:
=COUNTIF(StateData,G30)

and fill H30 into H31:H32.