About MrExcel Consulting Services Learn Excel Resources Challenge of the Month MrExcel Seminars Message Board MrExcel Store Podcast Search Contact Home

 Extracted from MrExcel.com Message BoardHere's a question I see often. "I'm trying to use the RANK function to sort the values in Column A, but, the problem arises when I have two or more cells with the same value. Then, the RANK also repeats some positions. For example, if I have, 50, 60, 62, 62, 67 in Column A I would get 5,4,2,2,1 in Column B. Is there a way I can get 5,4,2,3,1 ?"To do this you need a combination of RANK and COUNTIF as follows. If the data is in A2:A10, the formula in B2 would be:=RANK(A2,\$A\$2:\$A\$10)+COUNTIF(\$A\$2:A2,A2)-1and drag down till B10. By Juan Pablo Gonzalez on 25-Jan-2002 MrExcel.com Consulting can be hired to implement this concept, or many other cool applications, with your data. MrExcel.com provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.

Excel is a registered trademark of the Microsoft® Corporation.

All contents Copyright 1998-2008 by MrExcel Consulting.