+ Reply to Thread
Results 1 to 5 of 5

Help with vlookup

  1. #1
    Registered User
    Join Date
    03-01-2009
    Location
    arizona, US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Help with vlookup

    I am having trouble understanding the vlookup function in excel. I need to be able to compare the values of two columns (customer number and salesperson number) in two worksheets. If the two columns in each worksheet do not match I want to return the customer number in a third worksheet. I have tried to follow vlookup tutorials online, but have not been able to make vlookup work the way I need it to. Can anyone help me?

    Thanks,

    Ice
    Last edited by VBA Noob; 03-01-2009 at 03:51 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help with vlookup

    VLOOKUP matches one value to a column of data, then returns a value to the right of the match in another column.

    So, if on Sheet2 you had names and IDs like so:
    Please Login or Register  to view this content.
    Then on Sheet1 you were had a name in cell A2, in B2 you could put this formula to "VLOOKUP" the ID number over on Sheet2:

    =VLOOKUP(A1,Sheet2!$A$2:B$20,2,0)

    So, if you were comparing A2 to B2 and if they don't match, looking up the customer ID on sheet2 in column B and the value to match to your A1 is in column A on Sheet2, then the formula would look something like this:

    =IF(A2=B2,"Match",VLOOKUP(A1,Sheet2!$A$2:B$20,2,0))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help with vlookup

    Cross post I believe:
    http://www.mrexcel.com/forum/showthread.php?t=374608

    ...which is a no-no unless you list the cross-post links. Best though to pick a forum and go with it.
    Last edited by JBeaucaire; 03-01-2009 at 04:26 PM.

  4. #4
    Registered User
    Join Date
    03-01-2009
    Location
    arizona, US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Help with vlookup

    I have tried to make the formula your provided me work, but I am still having trouble. I am trying to use vlookup to search two entire columns on both sheets and return the customer number if the two column key does not match. IS the forumula you posted above able to do that?

    For example:
    Sheet 1
    Customer # Sales Person Code
    123 546
    456 546

    Sheet 2
    Customer # Sales Person Code
    123 546
    456 678

    If I can get my vlookup formula to work the way I want it to the formula on sheet three would display "456" as the two columns do not match between the two worksheets.

    Thanks!!!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help with vlookup

    This is one way, though I haven't addressed the "blanks" that result, probably could.

    Anyway, on sheet3, enter this formula anywhere and press CTRL-SHIFT-ENTER to activate the array in the first cell. Now copy it down and the numbers of concern will appear.

    =IF(ISERROR(MATCH(Sheet2!A2&"-"&Sheet2!B2,Sheet1!$A$2:$A$100&"-"&Sheet1!$B$2:$B$100,0)),Sheet2!A2,"-")

+ 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