+ Reply to Thread
Results 1 to 6 of 6

Lookup returning wrong values

  1. #1
    Registered User
    Join Date
    09-28-2013
    Location
    North America
    MS-Off Ver
    Excel 2010
    Posts
    78

    Lookup returning wrong values

    I've attached the file I'm using, but with the non-formula related cells blanked for privacy.

    The problem is on the "Math" sheet in column A. It's using a Lookup of column J on the "Calculator" sheet against a table. If you enter the Roman numeral equivalents of 0, 1, 2, 3, 4, 5, 6, 7, or 10 then it returns the correct value to column A. If you input the equal of 8 (VIII) then it returns 5.5 instead of 5 and if you input the equal of 9 (IX) then it returns 3 instead of 5.5.

    What is happening?
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Lookup returning wrong values

    Hi,

    The range passed as LOOKUP's lookup_vector must be sorted, which, in this case would need to be:

    0
    I
    II
    III
    IV
    IX
    V
    VI
    VII
    VIII
    X


    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    09-28-2013
    Location
    North America
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Lookup returning wrong values

    Quote Originally Posted by XOR LX View Post
    must be sorted
    Well that doesn't make any sense. Why would they do it that way?

    Is there an alternative to this rather than adjusting the entire lookup table? This one only goes 0 to 10 which is just that one number out of order, but I've got plans on expanding and Roman numerals go all over the place and it will be impossible to manage if I have to treat them as text and sort them alphabetically. For example, if there were a cell format for Roman numerals so that I could just type a "4" into the cell and it would display as "IV" but for sake of any functions Excel saw it as "4" instead. Now that would be perfect.
    Last edited by darxide23; 08-19-2020 at 02:13 AM.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Lookup returning wrong values

    Why did not you try VLOOKUP? The range of vlookup value does not required sorted value, while lookup does.
    Quang PT

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Lookup returning wrong values

    You can use VLOOKUP or INDEX/MATCH with an exact match parameter, e.g.:

    =VLOOKUP(Calculator!$J3,$L$12:$M$22,2,0)

    which does not require the lookup range to be sorted.

    Regards

  6. #6
    Registered User
    Join Date
    09-28-2013
    Location
    North America
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Lookup returning wrong values

    That's what I'm looking for. I didn't know VLOOKUP was all that different from LOOKUP. All resources I've read just say how similar and interchangeable they are. Even the Microsoft reference doesn't adequately convey the the sorted/unsorted aspect very well. I just used LOOKUP because it was simpler and I didn't need to lookup the other parts of the table here, just the one column and when you mentioned sorting I just assumed VLOOKUP to be the same.

+ 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. Index Match returning wrong values
    By CoachK88 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-03-2018, 12:48 AM
  2. [SOLVED] Lookup Returning Wrong Value
    By MJetter in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-15-2018, 02:59 PM
  3. [SOLVED] VLOOKUP Returning Wrong Values
    By happymonody in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-17-2015, 04:40 AM
  4. Lookup returning wrong results
    By jamesliv in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-05-2014, 11:13 AM
  5. WeekdayName returning wrong values
    By Newbie_Nick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2009, 02:15 AM
  6. Replies: 2
    Last Post: 05-24-2006, 05:35 PM
  7. Excel 2002 Lookup formula returning wrong results?
    By Val in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-18-2005, 05:10 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