+ Reply to Thread
Results 1 to 9 of 9

Pulling the customer name when I enter the customer number

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Pulling the customer name when I enter the customer number

    Hello,

    I am trying to have a sheet where I can enter a customer number in cell A2 and have the customer name automatically populate in cell B2 from the data on sheet 2. I tried different Vlookups, but could not get it to pull the customer name. The data is sorted alphabetically by the customer name. Any help would be greatly appreciated.

    Thanks,
    Chris

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Pulling the customer name when I enter the customer number

    If your customer name is in column A of sheet 2 and the customer # is in column B...

    Then if you put the customer name in column A of sheet 1, and enter this in column B it should pull the correct name, let's use A2 as an example:

    =VLOOKUP(A2,Sheet2!A:B,2,0)

    - Moo

    * Note, if your sheet names have spaces, ie: Sheet 2, then you need to use 'Sheet 2'!A:B in the formula
    Last edited by Moo the Dog; 12-04-2012 at 12:05 PM. Reason: Changed the range to A:B

  3. #3
    Registered User
    Join Date
    12-03-2012
    Location
    MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Pulling the customer name when I enter the customer number

    Thank you for the response Moo. That's what I was trying, but kept getting an N/A as the response. I attached the sheet as I had it, maybe that will help. I would like to be able to copy the customer number from sheet 2 and paste it in sheet 1 under the customer ID column and when I do that, have the client name get pulled into cell B2 on sheet 1.
    Attached Files Attached Files

  4. #4
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Pulling the customer name when I enter the customer number

    Two things:

    1. It's because you have the client #'s in column B of Sheet2... VLOOKUP doesn't look left, it looks right... need to use INDEX/MATCH, and
    2. The numbers in column B of Sheet2 are stored as text. Convert them to numbers, then the formula below will work in B2 and filled down as far as you need:

    =INDEX(Sheet2!$A$2:$A$14,MATCH(A2,Sheet2!$B$2:$B$14,0))

    - Moo

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Pulling the customer name when I enter the customer number

    c.seely.

    2 reasons you are not finding what you want.

    1, sheet1 A2 contains a value, but sheet2, B2:B14 contains text
    2. vlookup() cannot look "behind" itself. it looks down a column, B in your case, and then looks for vales in X columns to the RIGHT

    try this instead, it will fix both problems...

    =INDEX(Sheet2!$A$1:$B$14,MATCH(TEXT(Sheet1!A2,0),Sheet2!$B$1:$B$14,0),1)

    alternatively, you could create a dropdown in A
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Pulling the customer name when I enter the customer number

    @ Moo. is there an echo in here?

  7. #7
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Pulling the customer name when I enter the customer number

    @FD - Reminded me of a childhood trip to Howe Caverns

  8. #8
    Registered User
    Join Date
    12-03-2012
    Location
    MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Pulling the customer name when I enter the customer number

    That is the exact formula I was looking for! Thank you so much! I never used the index formula before.

    Chris

  9. #9
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Pulling the customer name when I enter the customer number

    Glad it helped!

    - Moo
    - - - - - - - - - -
    If the solutions provided have solved your issue, please mark the thread as [SOLVED] by clicking on 'Thread Tools' above your first post and select 'Mark Thread as Solved'.

    Also, a good way to say thanks to those who have helped is to click on the small star at the lower-left corner of one of their posts. It's always appreciated!

+ 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