+ Reply to Thread
Results 1 to 4 of 4

Help with a lookup that looks for part of a string

  1. #1
    Registered User
    Join Date
    02-27-2006
    Location
    Oxford England
    MS-Off Ver
    2007
    Posts
    54

    Help with a lookup that looks for part of a string

    Hi, Im going mad trying to figure out whats wrong with this forumla:

    =VLOOKUP(MID(E5,3,2),L76:N77,3,FALSE)

    E5 contains the number 4010805010
    L76:N76 contains an array with the number 10 in L:76 and the word "Direct" in N:76

    It should see E5 and start at the third character and return two characters = 10
    Then vlookup this value (10) in the array and return the word "Direct"

    So why does it give me a #N/A ?

    If I remove the MID(E5,3,2) part and just write the number 10 it works fine. But I need it to use the number 10 in the long number 4010805010 to work.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Help with a lookup that looks for part of a string

    Perhaps
    Please Login or Register  to view this content.
    (MID returns a string and your lookup values are probably numbers)

  3. #3
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Help with a lookup that looks for part of a string

    The result of the MID() function is a text value -- "10". The cell L76 has a number -- 10
    These two are not the same, even if they look the same.

    If you want to look up a number, you need to be sure to have a number as the search criterion, and not text that looks like a number.

    try

    =VLOOKUP(MID(E5,3,2)+0,L76:N77,3,FALSE)

    The "+0" will coerce the text value into a numeric value and your Vlookup will show the desired result.

    ---------- Post added at 09:49 PM ---------- Previous post was at 09:48 PM ----------

    sorry, PepeLeMoko, did not refresh before posting.
    Like a post? Click the star below it!

  4. #4
    Registered User
    Join Date
    02-27-2006
    Location
    Oxford England
    MS-Off Ver
    2007
    Posts
    54

    Re: Help with a lookup that looks for part of a string

    Ah, brilliant. So its a case of a number not actually being a number. Thanks for the help guys, it works well now.
    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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