+ Reply to Thread
Results 1 to 10 of 10

How to make a vlookup when the lookup_value has extra characters?

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    13

    How to make a vlookup when the lookup_value has extra characters?

    i have 2 sheets one has the SKU numbers and the other the SKUs with the quantity, and i would like to return the quantity from the 2nd sheet to the first sheet with a vlookup which is simple, the challenge is though all the SKUs on the first sheet starts with a few extra characters but the 2nd sheet not, and it has to stay that way, for example the SKU in the first sheet looks like this: "RCC-RUBBER67" and the SKU on the 2nd sheet looks like this: "RUBBER67".

    I tried to use this formula:

    =IF(A2="","",VLOOKUP(RIGHT(A2,LEN(A2)-FIND("-",A2)),Sheet2!A:D,2,0))

    And it works on most cells but on some i'm getting the #N/A error, and its when the SKU looks like this: RCC-15166

    It seams to work only when the SKU is letters but not numbers.

    Please find the attached file example.

    Any help would be highly appreciated.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to make a vlookup when the lookup_value has extra characters?

    when you convert the cell like you have in the formula
    ie RIGHT(A2,LEN(A2)-FIND("-",A2))

    you have converted the cell to text format
    to combat this change the lookup field to text and it will return the result

    attached is the file

    all i did was change the sheet2 column to text
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: How to make a vlookup when the lookup_value has extra characters?

    Yes that works, but in order for the error to go away i have to double click the sku for each cell on sheet2 and hit enter, even after converting the format to text.

    is there another formula i can use to do the same job without converting the cell to text, and then the need to manually convert the sheet2 to text..

    Please?

  4. #4
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: How to make a vlookup when the lookup_value has extra characters?

    Hi all,

    @Heshl: in the file you are sharing Sku 15166 is repeated three times. Do you need to sum the relevant values (=727) or to get only the first value (42)?
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: How to make a vlookup when the lookup_value has extra characters?

    all the skus in this file are only examples, and there is no repeated skus, i don't understand where you are going with this

  6. #6
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: How to make a vlookup when the lookup_value has extra characters?

    Hi again,

    in sheet2 I see:

    SKU Quantity
    RUBBER67 500
    RUBBER68 0
    RUBBER69 100
    RUBBER70 50
    15166 42
    15166 500
    15166 100
    15166 85

    Anyway, integrating the formula you are using

    =IFERROR(IFERROR(VLOOKUP(RIGHT(A2,LEN(A2)-FIND("-",A2)),Sheet2!A:D,2,0),VLOOKUP(RIGHT(A2,LEN(A2)-FIND("-",A2))+0,Sheet2!A:D,2,0)),"")

    Hope it helps

  7. #7
    Registered User
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: How to make a vlookup when the lookup_value has extra characters?

    oh you right about the repeated skus, i just dragged the first one down, seams the numbers didn't change, it was supposed to be like this:

    15166 42
    15167 500
    15168 100
    15169 85

    and your integrating works perfectly for my need, thanks so much..

    can you also explain how the 2nd vlookup with the +0 helps?

  8. #8
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: How to make a vlookup when the lookup_value has extra characters?

    Hi,

    first of all, please forgive my poor English and thanks for sharing feedback


    The segment:

    RIGHT(A2,LEN(A2)-FIND("-",A2))

    produces a string, but if you add a zero it produces a number.

    First VLOOKUP tries to match strings, if it fails, the second VLOOKUP tries to match numbers.


    Hope it helps
    Last edited by canapone; 10-16-2015 at 03:46 AM.

  9. #9
    Registered User
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: How to make a vlookup when the lookup_value has extra characters?

    Thanks a million it helps a lot, this site is amazing.. at this time to get help.

  10. #10
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: How to make a vlookup when the lookup_value has extra characters?

    Hi and thanks again,

    greetings from Firenze.

+ 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. 2 lookup_Value for Vlookup
    By bryceismad1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2014, 02:06 PM
  2. Hyperlinking a VLOOKUP lookup_value
    By hithro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2014, 01:46 PM
  3. Replies: 1
    Last Post: 05-14-2014, 10:11 AM
  4. How to make LOOKUP give zero if it can't find the lookup_value?
    By Dmitry Kopnichev in forum Excel General
    Replies: 3
    Last Post: 10-12-2005, 05:05 PM
  5. [SOLVED] How to make LOOKUP give zero if it can't find the lookup_value?
    By Dmitry Kopnichev in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-12-2005, 05:05 PM
  6. Use Sheetname as Vlookup lookup_value
    By robjeeves in forum Excel General
    Replies: 1
    Last Post: 04-28-2005, 08:43 AM
  7. Update Vlookup lookup_value
    By Phil Floyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2005, 12:06 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