RANK function

Gwill1983

Board Regular
Joined
Oct 24, 2018
Messages
124
Office Version
  1. 365
Platform
  1. Windows
Hi all,

The rank function is driving me insane!!

I am trying to add a rank column to my table, but to ignore the 0 values, not have duplicate ranks and show the lowest value (which isn't 0) as 1. So far, I have managed to do everything except for getting it to show the lowest value as 1. I would imagine it will be an easy formula tweak for an expert, but I am baffled!

So.... I have put the rank column in M and the total value that I am ranking is in column R. The formula that I currently have in my first rank cell (R4) is:

=IF(R4=0,"",RANK(R4,IF($R$4:$R$55>0,$R$4:$R$55,0))+COUNTIF($R$4:R4,R4)-1)

This shows the correct rank, doesn't duplicate rankings, and ignores the zeros, but I cannot get it to show the lowest value (that isn't 0) as required.

Can anybody help?

Thanks

Chris
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
When you say 0 do you mean the cells are empty or actually show 0? Are there any negative values?
 
Upvote 0
Maybe
=IF(R4=0,"",RANK(R4,IF($R$4:$R$55>0,$R$4:$R$55),1)+COUNTIF($R$4:R4,R4)-COUNTIF(R$4:R$55,0)-1)
 
Upvote 0
Or this in case of the negatives:

=IF(R4<>0,RANK(R4,$R$4:$R$55,1)+COUNTIF($R$4:R4,R4)-((R4>0)*COUNTIF($R$4:$R$55,0))-1,"")
 
Upvote 0
The Zero values were still getting ranked, so you need to subtract the number of Zeros from the rank value
 
Upvote 0
Hi all,

I have only just spotted that this is not returning a #1 in the rank column.

Can anybody help me to understand why?

Thanks

Chris
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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
Back
Top