+ Reply to Thread
Results 1 to 10 of 10

What's wrong with this LOOKUP function?

  1. #1
    Registered User
    Join Date
    01-18-2020
    Location
    Kolkata, India
    MS-Off Ver
    Office 365
    Posts
    2

    What's wrong with this LOOKUP function?

    I was just trying out the old LOOKUP function of excel, but every time it is returning me few wrong values. What's wrong with this lookup function?

    Yeah I know there are better formulas like vlookup, index/match, the latest xlookup to do the same thing. But I just wanna wanna know what I'm doing wrong over here? or the lookup function itself has any bug? Please correct me
    I'm attaching the excel file below.
    Attached Files Attached Files
    Last edited by csupra; 01-18-2020 at 12:41 PM.

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

    Re: What's wrong with this LOOKUP function?

    Welcome to the forum.

    Nothing is wrong, but it IS the wrong function for the job.

    LOOKUP does not have a lookup type argument, so the lookup values must be in order. If you order the table alphabetically by name, then the results will be correct.

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    F
    G
    1
    Lookup table Result Table
    2
    Name
    Reg_No
    Country Profession Name Reg_No
    3
    Alen
    101
    USA Designer Taylor
    170
    4
    Bob
    109
    German Youtuber John
    150
    5
    Chris
    103
    USA Data Analyst Alen
    101
    6
    John
    150
    Italy Painting Bob
    109
    7
    Martin
    105
    Australia Business Martin
    105
    8
    Taylor
    170
    UK Software Engineer Chris
    103
    Sheet: Sheet1

    Here a VLOOKUP with the final argument set at 0 (FALSE) will return an exact result.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,695

    Re: What's wrong with this LOOKUP function?

    The data in the lookup table has to be sorted, otherwise you will get wrong results. Sort A3:D8 by Name, and you will get the correct results.

    Hope this helps.

    Pete

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

    Re: What's wrong with this LOOKUP function?

    As explained in the LOOKUP() function help file:
    Quote Originally Posted by MS Excel help
    Important: The values in lookup_vector must be placed in ascending order: ..., -2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise, LOOKUP might not return the correct value. Uppercase and lowercase text are equivalent.
    The LOOKUP() function can only use a binary search type algorithm that requires the lookup values to be sorted. In your file, the names in column A are not sorted, so the LOOKUP() function's binary search algorithm gets lost.

    If you can sort the lookup table, then you can use the LOOKUP() function just fine. One of the advantages for the "newer" functions is that they have an "exact match" option that does not require the lookup table to be sorted.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: What's wrong with this LOOKUP function?

    HI,

    If you remember lookup works for sorted ascending fields, check the attached file.

    Would recommend to search you post before posting, Its already discussed "Lookup Returning Wrong Value"


    * Mark the thread as Solved, and hit * to say Thanks.
    Attached Files Attached Files

  6. #6
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: What's wrong with this LOOKUP function?

    in your case
    =LOOKUP(2,1/(F3=$A$3:$A$8),$B$3:$B$8)

  7. #7
    Registered User
    Join Date
    01-18-2020
    Location
    Kolkata, India
    MS-Off Ver
    Office 365
    Posts
    2

    Re: What's wrong with this LOOKUP function?

    Thank you! I skipped the part of sorting.

  8. #8
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: What's wrong with this LOOKUP function?

    tim201110 :-) It show the possibility to use LOOKUP even others can be used. Let me remember the TIP from MS
    Tip: We strongly recommend using VLOOKUP or HLOOKUP instead of the array form. See this video about VLOOKUP; it provides examples. The array form of LOOKUP is provided for compatibility with other spreadsheet programs, but it's functionality is limited.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: What's wrong with this LOOKUP function?

    Remember you don't need to sort if you use an appropriate function like VLOOKUP.

  10. #10
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: What's wrong with this LOOKUP function?

    but it's functionality is limited
    i like it
    =SUMPRODUCT(LOOKUP(H3:H11,A1:A11,D1:D11))
    and
    =SUM(VLOOKUP(INDEX(H:H,N(IF(1,ROW(H3:H11)))),A1:D11,4)) array
    what did they mean by limited?
    Attached Files Attached Files

+ 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. Lookup Function - Gives Wrong Value
    By saleh_binmasood in forum Excel General
    Replies: 10
    Last Post: 01-02-2011, 05:09 AM
  2. [SOLVED] lookup function bringing in wrong info
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 35
    Last Post: 09-06-2005, 07:05 PM
  3. lookup function bringing in wrong info
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 35
    Last Post: 09-06-2005, 05:05 PM
  4. lookup function bringing in wrong info
    By Julieeeee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  5. lookup function bringing in wrong info
    By Julieeeee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  6. [SOLVED] lookup function bringing in wrong info
    By Julieeeee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  7. lookup function bringing in wrong info
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 09-06-2005, 05:05 AM
  8. [SOLVED] lookup function bringing in wrong info
    By Julieeeee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

Tags for this Thread

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