+ Reply to Thread
Results 1 to 9 of 9

Need Little Help with Vlookup code

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Need Little Help with Vlookup code

    Hi I have an excel file with 3 columns on sheet1 ("Name", "ID" and "Name Data"): "Name Data" is a blank column.

    Name ID Name Data
    Albert 4235
    John 4237
    Ramesh 4239
    Micky 4241
    Minnie 4243
    Donalid 4245
    Edited 4247
    Goofy 4249

    On sheet 2, there will be a similar ID column with only one ID: eg:
    ID
    4243

    I want the vlooup code to match the ID value on sheet2 (in this eg, that would be "4243") with ID value on sheet 1 and copy The name associated with that ID to "Name data" of sheet1. The result should look like:

    Name ID Name Data
    Albert 4235
    John 4237
    Ramesh 4239
    Micky 4241
    Minnie 4243 Minnie
    Donalid 4245
    Edited 4247
    Goofy 4249

    Here is the code I have:
    Please Login or Register  to view this content.
    The only issue with this code is that it copies the name onto first cell under "Name data". Eg: it do the following:

    Name ID Name Data
    Albert 4235 Minnie
    John 4237
    Ramesh 4239
    Micky 4241
    Minnie 4243
    Donalid 4245
    Edited 4247
    Goofy 4249

    The minnie should get copied on 5th row under "Name data" and not on 1st row (excluding heading rows)

    Can anyone please suggest me what to fix in the code?

    Thanks a ton!
    Last edited by vlady; 02-04-2013 at 03:34 AM. Reason: code tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Need Little Help with Vlookup code

    Where does 'Minnie' come from?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2010
    Posts
    290

    Re: Need Little Help with Vlookup code

    Hi,

    nupur can u upload a sample sheet.
    Happy to Help

    VISHA

    Click *, if the suggestion helps you!
    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>> "Mark your thread as Solved"

  4. #4
    Registered User
    Join Date
    01-25-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need Little Help with Vlookup code

    Here is the attched file.
    Attached Files Attached Files

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Need Little Help with Vlookup code

    There's no data on Sheet2.

  6. #6
    Registered User
    Join Date
    01-25-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need Little Help with Vlookup code

    Hi Norie,

    Thanks for your reply.. I am sorry. there should be id, "4243" under Col "ID" on sheet2.

  7. #7
    Registered User
    Join Date
    01-25-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need Little Help with Vlookup code

    Hi,

    Here is the file again.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-25-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need Little Help with Vlookup code

    Can anyone please reply? I would truly appreciate that.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Need Little Help with Vlookup code

    I think you need to clarify a couple of things.

    What are you looking up, where are you looking it up and what do you want to return

    For example, do you want to return the name corresponding to the ID in A2 on Sheet2 to B2 on Sheet2?

+ 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