+ Reply to Thread
Results 1 to 9 of 9

I need help with VLOOKUP

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    16

    I need help with VLOOKUP

    Hello,

    I'm trying to edit a long list of accounts and insert the rep name into the list by the rep code. Column D shows rep codes and may have any number of a given code. I've moved the list of rep codes by name (1 each) into Coulmns J & K. I would like to move the proper name into column E. I believe VLOOKUP is the proper formula but I can't figure it out. Help!

    Thanks,

    Todd

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: I need help with VLOOKUP

    Hi Todd, Welcome to the forum,
    Not sure of your layout (ideally, you can upload an example sheet of what you have and what you want to have using Go Advanced> Manage Attachments).
    You have a list of all rep codes in J and corresponding names in K? and you also have a rep code in D and want the name in E?

    If I am correct, then something like
    =VLOOKUP(D2,$J$1:$K$200,2,FALSE)
    Questions?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    09-19-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: I need help with VLOOKUP

    Thanks for responding. I ultimately got it to work with trial and error but I don't fully understand the formula yet. I can't upload an example as this is sensative data. Basically I have one Sheet with with Rep Names and Rep Numbers. Reps have more than one rep number. I have another sheet with Rep Numbers and assets by account. I need to get the rep names into each line on the 2nd sheet. Rather than sorting by rep number and pasting in rep names for 16k lines, I moved in the column of Rep Names and Rep Numbers (523 lines) and created the following setup.

    I want a formula (say in column D) to Identify the rep code in the adjacent cell (C), then look for that number in another column (A), and then take the name from the adjecent cell (B) and place it in D. At 1st I didn't understand that the rep codes I wanted to search through needed to be in A. But here is the formula that ultimatley worked (in cell D2 and then pasted throughout the column):

    =VLOOKUP(C2,A2:B523,2,FALSE)

    I don't know if that was the best way to do it. What is with all the "$" symbols that everyone uses in VLOOKUP examples?

    Thanks again.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: I need help with VLOOKUP

    Okay, first, here's what the dollar signs do;
    When you copy a formula or drag a formula, it automatically adjusts the cell references. For example, if in C1, you have = A1 + B1 and you copy that to C2, it will automatically become = A2+B2. If you move it to F1, it will become = D1 + E1. Mostly that's what you want. If you want absolute references and not relative references, you use the $ as anchors. A $ in front of the column locks the column, in front of the row locks the row. So if it was (in C1) = $A1 + $B1 and you copied it over to F1, you'd still have =$A1+$B1, however, if you copied it down, in C2, you'd have =$A2 + $B2 (the row isn't anchored). To lock both, it would be = $A$1 + $B$1

    In a VLOOKUP, typically, you want the first argument (C2 in your example) to change as you drag it down so don't anchor it. However, the range you want to remain constant, it should always be A2:B523 so anchor it with $A$2:$B$523
    Hope that helps.

  5. #5
    Registered User
    Join Date
    09-20-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: I need help with VLOOKUP

    As you already found out vlookup works from left to right.

    In your case it is easy to put the columns in the correct order so that the rep number is the first column in the range but if you couldn't change the order for a reason or another, you could use index and match instead of vlookup. I have attached an example (2007)for you to look but basically the formula then looks like this

    =INDEX($A$2:$B$9,MATCH(H2,$B$2:$B$9,0),1)

    where A2:B9 is your rep name/number grid and H2 is the rep number in your destination sheet.The match part works out the row number and the last argument is the column. You can make it look in more than just column 1 for the result by using a match function there too if you need.

    Have a play with the attached example by moving things around and it will soon make sense.example using index and match.xlsx

  6. #6
    Registered User
    Join Date
    09-19-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: I need help with VLOOKUP

    Thanks so much! I should have signed up for this site years ago!

  7. #7
    Registered User
    Join Date
    09-19-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: I need help with VLOOKUP

    Thanks for the suggestion. I'm trying to use this Index/Match process for something else. In this case I need to Aggregate the rep codes into one cell. In your example the assets results are all on a seperate line, but I now need to look up all rep codes and joint rep codes and have the results put together. Is this possible?

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: I need help with VLOOKUP

    Can you upload an example spreadsheet showing what you have and what you want the results to look like? (Go Advanced>Manage Attachments)

  9. #9
    Registered User
    Join Date
    09-19-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: I need help with VLOOKUP

    I've got it solved now. 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