+ Reply to Thread
Results 1 to 10 of 10

Issue with Rank Formula

  1. #1
    Registered User
    Join Date
    02-24-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    19

    Issue with Rank Formula

    Having issues with a Rank Formula. Any help is much appreciated. The formula is below.

    =RANK(E2,$E$2:$E$26,0)+COUNTIF($E$2:E2,E2)-1


    Moderator comment: Crossposted https://www.ozgrid.com/forum/forum/h...h-rank-formula
    Last edited by alansidman; 10-05-2018 at 08:21 AM.

  2. #2
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Issue with Rank Formula

    It may help to explain what the issue is, along with providing other details and/or a sample spreadsheet. Other details could be what you're trying to accomplish, the expected result(s) for sample data, etc.

    The formula you provided is a valid formula.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Issue with Rank Formula

    What's the problem?
    What are you expecting, and what are you getting?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    02-24-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Issue with Rank Formula

    I've attached a sample. It's skipping 4 in the rank formula.


    Sample.xlsx

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Issue with Rank Formula

    Upon download I found what appears to be a floating point issue in the data.

    Entering
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in an unused area returns this array.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Those numbers (8 and 11) correspond with the $1,875.00 figures. They should both be 8s.

    Shadowing column E with rounded values in column F (ROUND(E2,2)) and then changing the formula in column C to reference F produced expected results.

    What is strange is that restoring references in C back to column E now produced the expected returns, and
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    then returned the array
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    . In other words the floating point seemed to disappear from column E and your formula worked fine!!

    Please try the MATCH function at your end to confirm the differences between the $1,875.00 figures. RANK and COUNTIF seem to be evaluating them differently.

    As for the evident "self correction" I have no explanations.
    Last edited by FlameRetired; 10-04-2018 at 09:33 PM.
    Dave

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Issue with Rank Formula

    Definitely a floating point error. I put =(1875-E9) into F9, formatted as scientific, and got a result of -2.27E-13 -- not exactly 0 In F12, the results was 0.00E+0 (exactly 0). So the two 1875 values are not exactly the same, and Excel is seeing the value in E9 as slightly larger than then the value in E12.

    I followed Dave's sequence (ROUND() function in column F, replace references in C to column F, then replace references to F back to E). When I changed the references to F, I got the expected results that Dave noted. However, when I reverted back to E references, the erroneous results returned.

    The sample you have given has "constants" in column E, so we have no idea how these values are calculated. Obviously something in the process is susceptible to floating point error. You will need to do something with the calculation process to account for floating point error. A ROUND() function may be enough, but you will need to test that.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Issue with Rank Formula

    @ MrShorty

    Thank you for attending to this and confirming FP. Those looked like hard numbers, but then again we've seen that before.

    That leaves accounting for the missing rank 4. Tested independently COUNTIF apparently ignores the tiny differences due to floating point while RANK and RANK.EQ do not.

    Floating point seems to be something Excel ... or computers are rather fickle about. LOL

  8. #8
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Issue with Rank Formula

    The root issue does seem to be the difference noted above. If 1875 is entered in E5, the results give two 4s and no 5 - other similar tests (with same or other numbers) give similar problems. Unless there's a way of fixing this by putting ROUND into the formulae themselves (which I haven't found in the few minutes I've looked at this), then I think the easiest solution will be a helper column using ROUND, as MrShorty implied above.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I'm sure someone else might have a more elegant solution.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  9. #9
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,291

    Re: Issue with Rank Formula

    Please Login or Register  to view this content.
    Try this formula
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,998

    Re: Issue with Rank Formula

    Has everyone overcomplicated this?? It would be nice if you had told us what result were you expecting to see!!

    Maybe:

    1,2,3,4,5,5,5,5,5,5,etc
    where the two 1875s are 3 and 4...

    or

    1,2,3,3,4,4,4,etc
    where the are both given rank 3 and there are no missing values

    or 1,2,3,3,5,5,5,etc

    Here are all 3 options...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Rank Number Issue
    By ScabbyDog in forum Excel General
    Replies: 1
    Last Post: 05-10-2016, 07:14 AM
  2. [SOLVED] VLookup issue when using RANK and a Tie occurs
    By ehatz in forum Excel General
    Replies: 3
    Last Post: 08-31-2015, 04:00 PM
  3. [SOLVED] forcing a rank on 1 through 5 (no dups) using the rank formula in Excel
    By denver1717 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-22-2015, 08:28 AM
  4. [SOLVED] Issue with Rank Count Formula
    By Doofus1 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-16-2014, 03:47 PM
  5. [SOLVED] Rank and Vlookup N/A issue
    By swarv in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-04-2014, 05:29 AM
  6. [SOLVED] Having an issue with a formula used to rank column numbers earlier but now is failing .
    By Securitysports in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-02-2013, 06:04 PM
  7. Formula to Rank and populate values base don Rank
    By Excel Dumbo in forum Excel General
    Replies: 3
    Last Post: 10-09-2012, 02:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1