formula to rank selected range of numbers ignoring the blank

dhananjaywalke

Board Regular
Joined
Jun 26, 2006
Messages
60
formula to rank selected range of numbers ignoring the blank if any.

I have 29 numbers in a column.

I want to rank them 1 to 5. But if any of the 29 numbers are zero then formula ranks them as 1 & then proceed to rank 2 3 4. I want formula to ignore zero or blank & rank minimum non zero as 1st.

Could anybody help me?

Thanks
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
20,527
Office Version
  1. 365
Platform
  1. Windows
Assuming that A2:A30 contains the data, try...

B2, copied down:

=IF(A2<>0,SUMPRODUCT(--($A$2:$A$30<>0),--(A2>$A$2:$A$30))+1,"")

Or are you looking for a Top 5 list?
 

dhananjaywalke

Board Regular
Joined
Jun 26, 2006
Messages
60
Yes Domenic

I want top five

also worst 5 out of these number.

i want to rank then & i dont want the number which is top 1 or worst 1
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
20,527
Office Version
  1. 365
Platform
  1. Windows
The following will return a Top N list, where 0's and the Top 1 are ignored. Assuming that A2:A30 contains the data...

B2: 5

(This indicates that you'd like a Top 5 list. Change this as desired.)

C2:

=SUM(IF(A2:A30<>0,IF(ISNUMBER(MATCH(A2:A30,SMALL(IF(A2:A30<>0,A2:A30),ROW(INDEX(A:A,2):INDEX(A:A,B2+1))),0)),1)))

...confirmed with CONTROL+SHIFT+ENTER.

D2, copied down:

=IF(ROWS($D$2:D2)<=$C$2,SMALL(IF($A$2:$A$30<>0,$A$2:$A$30),ROWS($D$2:D2)+1),"")

...also confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 

Forum statistics

Threads
1,176,419
Messages
5,903,014
Members
435,002
Latest member
chenmoti

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top