+ Reply to Thread
Results 1 to 11 of 11

Nest LEFT in VLOOKUP producing error

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Nest LEFT in VLOOKUP producing error

    Hello,

    I have the below formula that, for some reason, is producing an error.

    =VLOOKUP(LEFT(R19,6),'Data'!A:B,2,0)

    I am using Microsoft Excel 2010.
    Any thoughts?

    Thanks!
    Last edited by msawyer; 12-07-2012 at 07:24 PM. Reason: Updated version of excel using

  2. #2
    Registered User
    Join Date
    09-11-2012
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Nest LEFT in VLOOKUP producing error

    Try the following:

    =VLOOKUP(LEFT(R19,6),Data!A:B,2,FALSE)

    Hope this helps!

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,377

    Re: Nest LEFT in VLOOKUP producing error

    Any thoughts?
    Based on the information provided, not really. The formula itself looks OK. So, first question is, what's in cell R19? And, therefore, what are the leftmost six characters? Are they alphabetic or numeric or a combination? What does the data look like in column A of the Data sheet? Is that alphabetic or numeric or a combination? Could there be leading or trailing spaces? Does the cell have a "number" in it but it's formatted as text? What error do you get? Does the value actually exist in column A of the Data sheet?

    So, no ideas, just lots of questions.


    Best idea is to upload a sample workbook with some typical data which demonstrates the problem.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Nest LEFT in VLOOKUP producing error

    Tried changing '0' to 'FALSE'. Still doesn't work. Thanks.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,377

    Re: Nest LEFT in VLOOKUP producing error

    The single quotes are only necessary if the sheet name has spaces in it. It shouldn't make a difference when there are no spaces.


    Regards, TMS

  6. #6
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Nest LEFT in VLOOKUP producing error

    Here are the answers to your questions.

    Cell R19 contains a "number". Example 123456-123 The leftmost six characters should be 123456.
    Cell R19 is formatted as "General"
    Column A contains numbers. Example 123456, 987654, 456321.
    Column A is formatted as "General"
    I checked for leading and trailing spaces but didn't see any. Isn't there a function to remove those from a cell? Not sure what the function is.
    The error comes up as #N/A.
    The value does indeed exist in column A of the Data sheet.

    I've uploaded a sample workbook.

    Thanks for the help.
    Attached Files Attached Files

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,377

    Re: Nest LEFT in VLOOKUP producing error

    =VLOOKUP(--LEFT(B1,6),Data!A:B,2,0)

    LEFT, RIGHT and MID, amongst many functions, produce text strings ... which will not match the numeric value in the lookup table.

    The -- coerces the 6 character text string (of numbers) into a numeric value.


    Regards, TMS

  8. #8
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Nest LEFT in VLOOKUP producing error

    Thank you Trevor. That seems to work. What is weird is I have the same formula in another excel file (created in version 2007) that works just fine. Is this something new to 2010?

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,377

    Re: Nest LEFT in VLOOKUP producing error

    No. it must be something to do with the format of the data in the other Excel file. Perhaps the column is formatted as text, or the values have single quotes.

    Basically, the format of the lookup data needs to match the format of the data being searched. If it doesn't, it won't work. Simple as that.

    Excel 2010 may have "looked at" your data and thought, "I know, that looks like a number, I'll make it numeric ... just being helpful" That I don't know, I don't have 2010.


    Regards, TMS

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,377

    Re: Nest LEFT in VLOOKUP producing error

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,377

    Re: Nest LEFT in VLOOKUP producing error

    Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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