+ Reply to Thread
Results 1 to 6 of 6

VLOOKUP returning incorrect values for unfound match

  1. #1
    Valued Forum Contributor scaffdog845's Avatar
    Join Date
    02-01-2008
    Location
    Aston, PA. USA.
    MS-Off Ver
    Microsoft 365
    Posts
    373

    VLOOKUP returning incorrect values for unfound match

    Good afternoon all,

    I'm trying to help a colleague automate a daily process he must perform in Excel. I had suspected it to be a simple job for a VLOOKUP formula, however incorrect values are being returned for items without a match.

    In the attached example the 'Final! sheet is where he would have to manually enter amounts from an SAP printout into C:C for jobs matching job numbers in B:B. The sheet 'Source Data! is a striped down example of an SAP data dump where he retrieves his information.

    The VLOOKUP formula I added to D:D has a couple of issues I could use a hand with.

    1. When a value from 'Final!B:B is not found in 'Source Data!B:B, the formula appears to return the value from the previous item.

    2. Some values in 'Final!B:B have either an "-s" or "-ss" appended to what needs to be matched in 'Source Data!B:B. I believe limiting the lookup to the first 8 characters starting from the left would suffice.

    Any suggestions?

    As always.... thamks for the help!
    Attached Files Attached Files
    Last edited by scaffdog845; 06-15-2010 at 01:31 PM. Reason: Solved
    Click here to read the Forum Rules
    Whatever it is in life you decide to go after, go after with great ferocity.

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: VLOOKUP returning incorrect values for unfound match

    Try to add 0 or FALSE into the fourth arqument of VLOOKUP formula
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP returning incorrect values for unfound match

    Perhaps?

    =IF(ISNA(VLOOKUP(SUBSTITUTE(SUBSTITUTE(B2,"-ss",""),"-s",""),SAPCostDump,106,0)),"",VLOOKUP(SUBSTITUTE(SUBSTITUTE(B2,"-ss",""),"-s",""),SAPCostDump,106,0))

    or in 2007

    =IFERROR(VLOOKUP(SUBSTITUTE(SUBSTITUTE(B2,"-ss",""),"-s",""),SAPCostDump,106,0),0)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    02-16-2010
    Location
    Centrl Florida
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: VLOOKUP returning incorrect values for unfound match

    So if i understand this correctly. you want an exact match from column B on "Final" to match column B on "Source Data" and return the value in column 106 (DC). your formula is almost correct to do that. you simply need to change the formula in Cell D2 from

    =VLOOKUP(B2,SAPCostDump,106)

    to

    =VLOOKUP(B2,SAPCostDump,106,false)

    and copy it down. However, when you do this you will get a lot of noise from errors when nothing matches at all. to combat that you can use this formula in cell D2 and copy it down instead.

    =IF(ISERROR(VLOOKUP(B2,SAPCostDump,106,FALSE)),"",VLOOKUP(B2,SAPCostDump,106,FALSE))

  5. #5
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: VLOOKUP returning incorrect values for unfound match

    Independent from excel version formulae

    =LOOKUP(99^99,CHOOSE({1,2},0,VLOOKUP(SUBSTITUTE(SUBSTITUTE(B2,"-ss",""),"-s",""),SAPCostDump,106,0)))

    HTH
    Last edited by contaminated; 06-15-2010 at 01:31 PM.

  6. #6
    Valued Forum Contributor scaffdog845's Avatar
    Join Date
    02-01-2008
    Location
    Aston, PA. USA.
    MS-Off Ver
    Microsoft 365
    Posts
    373

    Re: VLOOKUP returning incorrect values for unfound match

    All great suggestions guys. Thanks for the help. I went with NBVC on this one as his solution helped by stripping the "-s" and "-ss" from the job names before looking for the match as well as eliminating the issue of phantom results.

    judging from the avatars I would say we have some world cup excel guru fans out there! Enjoy the rest of the matches.

    THANKS

+ 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