+ Reply to Thread
Results 1 to 30 of 30

VLookup producing incorrect table

Hybrid View

  1. #1
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    VLookup producing incorrect table

    Hi, Can somebody have a quick look at this please. The table on the managers page should be sorting highest to lowest from column L (then K) but it's not and I can't see what I've got wrong.

    Many thanks.
    Attached Files Attached Files
    Last edited by Marvo; 02-16-2021 at 08:41 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    What do you mean by 'should be'? What have you done to effect the sort?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    I don't know. I thought I'd done it correctly, 1st place should be Jack Jennings as he has a perfect record of 3 points per game. Then Herbert Chapman with 1.708. It's obviously not sorting on high to low Column L, I don't know why.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    But it's sorting on column A, which is what you've asked it to do.

    So, what is the problem? Is this about your calculations or about Excel sorting on column A?
    Attached Files Attached Files

  5. #5
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    Yes, I've obviously got something wrong in the formula in Column B because the number given to Jack Jennings should be the highest. That's what I don't understand, I cant see the error. Be something simple I bet.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    OK, probably, but as I have no idea what the logic is (and I'm not about to start trying to back engineer your failing formula), I can't help right now.

    Please lay out in WORDS the logic that you wish to apply and tell us which should be the top five, in what order and why.

  7. #7
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    The logic. The table is the records of managers of Northampton Town FC throughout their history. I want the table sorted on their success rate, average points per game, shown in Column L.
    Column K is used as a tiebreaker should any manager be level.

    The top 5 should be (High to low)

    Jack Jennings 3
    Herbert Chapman 1.7
    Colin Calderwood 1.69
    Chris Wilder 1.67
    Jack Tresadern 1.58

    At the bottom 4 managers have a total of 0, so they are being sorted by Column K and that is working correctly.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    I think you have been seriously over thinking this!

    A4 copied down:

    =LARGE($L$4:$L$53,ROW(A1))

    B4 copied down:

    =L4

  9. #9
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    That's done it. Lovely.

    All these VLookup formulas were done for me over a decade ago so when I make new tables I try to adapt from previous ones. I'm now guessing I've lots of tables that were "seriously over thought".

    many thanks.

  10. #10
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    I've just realised, that's no longer using column K as a "tiebreaker" and at the bottom it's listing the same manager 4 times. So I'm back to square one.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    OK - I'll have a look at that, but no, you are not back at square one.

  12. #12
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    I think the simple issue is Ali, why is the lookup formula in B4

    =L4/100+K4/100^2+COLUMN(C4)/100^3-ROW(B4)/100^4

    producing a higher number than the formula in B16

    =L16/100+K16/100^2+COLUMN(C16)/100^3-ROW(B16)/100^4

    when L4 = 1.708
    and L16 = 3

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    In A4:

    =LARGE($B$4:$B$53,ROW(A1))

    In B4:

    =L4+(K4/10000000000000000)

    I think the simple issue is Ali, why ...
    Because they obviously aren't doing what you think they should be doing, and given there's a simpler solution, I'm not going to be working out why they don't work. Sorry!
    Last edited by AliGW; 02-16-2021 at 08:41 AM.

  14. #14
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    That's done it this time. Perfect. Thank you.

    A general question if you don't mind? What is the reason behind all those zero's in B4?

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    Look carefully:

    =L4+(K4/ 10000000000000000)

    I am dividing K4 by a large number so that it returns a small fraction. I don't want it returning something larger as it would skew the first line rankings on the average points column.

  16. #16
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    Ah, okay. Thank you. I thought that the formula always used the first part and only went to the second if required. I didn't realise the second part could affect the first part.

    Many thanks again.

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    That's correct, but if I allowed it just to add the GD score, then the overall ranking would be increased by +/- 1, and then you'd have your final 4 all over the shop. The tie-breaker has to be a very small fraction: say the average score that is tied is 1.888934: I want the breaker to be somewhere between 1.888934000001 and 1.888934999999. Does this clarify it?

  18. #18
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    To be honest, no, I'm afraid this is all above my pay grade. To put it into terms I understand, you have two result. Leeds beat York 1-0. Stoke beat Crewe 2-0. So Leeds and Stoke both have 3 points so to decide who goes top we go to goal difference and Stoke have +2 to Leeds +1 so they are top. If your first port of call is points to decide who is first or second, I don't see how the goal difference part of the formula could or should affect the overall ranking?

    It doesn't matter though, you say it does and that's good enough for me. I'm all done again.

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    Because YOU said this:

    I've just realised, that's no longer using column K as a "tiebreaker" and at the bottom it's listing the same manager 4 times. So I'm back to square one.
    I thought it perfectly reasonable, therefore, to use column K (the goal difference column) as the tie-breaker ...

    Your first port of call is the average points. If the average points are the same, then you need a tie-breaker - you informed me that you expected the goal difference to be used as this. I don't understand what it is that you aren't getting. This is not complicated maths - I'm no mathematician (only a C at O Level).

    It IS important that you understand, otherwise you will always be reliant on others to fix things for you.
    Last edited by AliGW; 02-16-2021 at 09:11 AM.

  20. #20
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    Everything you say there is correct. But if the first criteria isn't the same, why would the second criteria affect it? That's what I don't understand.

    You said "then you'd have your final 4 all over the shop" if we didn't use a fraction.

    Incidentally the guy who originally set it all up used 100^2 and then 100^3 (and so on) to establish the criteria to take president. Is that the same thing as using all those zero's?

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    It is the same principle, but as you know, his formulae were not working, so let's forget about them now.

    Let me try again.

    Excel 2016 (Windows) 32 bit
    B
    C
    D
    E
    F
    1
    Ave.
    GD
    Ave. + GD/10000
    Rank
    2
    Jeff
    1.92
    34
    1.92034
    1
    3
    Larry
    1.62
    9
    1.62009
    4
    4
    Gordon
    1.78
    -6
    1.77994
    3
    5
    Hal
    1.78
    2
    1.78002
    2
    Sheet: Sheet1

    I have split the tie between the final two managers, whose average score is the same, by adding their goal difference scores divided by 10000, before ranking them. Does this illustrate the point?

    In practice you'd use a larger number (e.g. 100000000000000000000000000) to avoid affecting the average score through rounding up.

    Excel 2016 (Windows) 32 bit
    B
    C
    D
    E
    F
    1
    Ave.
    GD
    Ave. + GD/100000000
    Rank
    2
    Jeff
    1.92
    34
    1.92000034
    1
    3
    Larry
    1.62
    9
    1.62000009
    4
    4
    Gordon
    1.78
    -6
    1.77999994
    3
    5
    Hal
    1.78
    2
    1.78000002
    2
    Sheet: Sheet1
    Last edited by AliGW; 02-16-2021 at 09:41 AM.

  22. #22
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    In fairness, his formula were/are working, it's just when I went to transpose them on to another table, something I've done with success countless times before, it didn't work this time. It will be something incredibly simple but I couldn't spot it and that's why I posted originally.

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    OK - well, all I am trying to do is explain why my solution works, not what you did to cause his to fail.

    I hope that's enough for you. Sorry, but I can't be of any further help.
    Last edited by AliGW; 02-16-2021 at 09:47 AM.

  24. #24
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    That's okay, you've helped me enormously.

    I think I do get it now but why do we add the goal difference to the points, they are completely different criteria? I'd have thought it would have been a separate equation only to be used in the event of the first equation resulting in an exact tie. Like an IF statement or something you'd use in conditional formatting.

    be like saying to somebody, go to the chest of drawers in the bedroom and in the top drawer you should find what you're after. However if it's not in there then try the second drawer?

    Any I digress. Its all very interesting. My problem is as it has always been that I work on these things for a time, then go months, even years before I have to delve into the workings of them again and by that time I've simply forgotten how I did it in the first place and have to start again. I do solve my own problems lots of times now but when I can't I'm stumped. I think it's my age.

    Many thanks again.

  25. #25
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    OK - here's a different approach that you might understand better:

    Excel 2016 (Windows) 32 bit
    D
    E
    F
    G
    H
    I
    J
    4
    Ave.
    GD
    GD Rank (Ascending)
    Ave. + GD Rank/10000
    Final Rank
    ALL IN ONE
    5
    Jeff
    1.65
    9
    4
    1.65004
    1
    1
    6
    Hal
    1.65
    3
    2
    1.65002
    3
    3
    7
    Simon
    1.65
    -3
    1
    1.65001
    4
    4
    8
    Larry
    1.65
    7
    3
    1.65003
    2
    2
    9
    =RANK(F5,$F$5:$F$8,1) =E5+RANK(F5,$F$5:$F$8,1)/100000 =RANK(H5,$H$5:$H$8) =RANK(E5+RANK(F5,$F$5:$F$8,1)/100000,$H$5:$H$8)
    Sheet: Sheet1

    For this approach in your workbook, you'd need this in B4:

    =L4+RANK(K4,$K$4:$K$53,1)/100000000000000
    Last edited by AliGW; 02-16-2021 at 10:16 AM.

  26. #26
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    I get that. You're awarding a higher rank/score to the person with the better goal difference, then adding that to their average. I understand.

    So, give me an example as above of how the GD ranking could adversely affect the actual final ranking which you referred to earlier when you said "then you'd have your final 4 all over the shop".

    That's the bit I don't get.

  27. #27
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    It's to do with dividing it down to a small enough number, not the score itself. Consider this:

    Excel 2016 (Windows) 32 bit
    D
    E
    F
    G
    H
    I
    J
    K
    4
    Ave.
    GD
    GD Rank (Ascending)
    Ave. + GD Rank/10
    Final Rank
    Ave. + GD Rank/1000000000000
    Final Rank
    5
    Jeff
    1.65
    9
    5
    2.15
    1
    1.650000000005
    2
    6
    Hal
    1.65
    3
    3
    1.95
    4
    1.650000000003
    4
    7
    Simon
    1.65
    -3
    1
    1.75
    5
    1.650000000001
    5
    8
    Larry
    1.65
    7
    4
    2.05
    2
    1.650000000004
    3
    9
    Gordon
    1.84
    0
    2
    2.04
    3
    1.840000000002
    1
    Sheet: Sheet1

    Gordon should be top dog, but because I only divided the GD rank by 10, the calculations have left him third (yellow). Look at the green calculations far right - they are correct.
    Last edited by AliGW; 02-16-2021 at 10:44 AM.

  28. #28
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    I did as you asked, but I see you've gone offline. Hopefully you'll see this at some point.

  29. #29
    Forum Contributor Marvo's Avatar
    Join Date
    01-15-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2021
    Posts
    1,007

    Re: VLookup producing incorrect table

    Yep, now I understand. Thanks.

  30. #30
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,997

    Re: VLookup producing incorrect table

    No worries.

+ 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] sum formula not working, producing incorrect answers Excel 2003
    By crzyg8r in forum Excel General
    Replies: 6
    Last Post: 09-28-2016, 12:14 PM
  2. Vlookup Producing Error Codes
    By Bedmunds in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-17-2015, 07:40 AM
  3. [SOLVED] VLookup with concatenate not producing result
    By Sc0tt1e in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-20-2014, 11:08 AM
  4. [SOLVED] Conditional format formula producing incorrect results?
    By Dougie12. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-20-2014, 03:02 PM
  5. [SOLVED] Producing a list using vlookup with second criteria
    By alfgrey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-26-2013, 03:38 PM
  6. vlookup producing wrong results
    By moley165 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-05-2013, 08:21 AM
  7. [SOLVED] VLOOKUP producing #N/A
    By brooksbrah in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-28-2012, 04:28 PM

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