+ Reply to Thread
Results 1 to 10 of 10

Thread: VLOOKUP Question

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    VLOOKUP Question

    Hello,

    It has been a while since working with Excel so I'm a little rusty. I need some assistance with a VLOOKUP formula. I have a spreadsheet with 7 tabs. 6 of the tabs get their data from reports that I extract the data from. Each of those 6 tabs have 3 columns; Name, AcctNbr, and Balance. The 6 tab names are: SurplusBal, ShortageBal, CurrentBal, TotalNewPmt, ShortageAdj, and DeficiencyAdj. I created a 7th tab and named it FinalData. This tab has cloumns named Name, AcctNbr, ShortageBal, CurrentBal, TotalNewPmt, ShortageAdj and DeficiencyAdj. I copied all the names from the Name column in the CurrentBal tab to the Name Column on the FinalData tab. Now I am trying to write formulas on the FinalData tab that will look at the name in the Name column on the FinalData tab and then look at the other tabs to bring over what I need. For example:
    I want to look at the name in the Name column on the FinalData tab and then populate the balance amount from the SurplusBal tab into the SurplusBal column in the FinalData tab. If the name doesn't exist in the Name column on the SurplusBal tab then leave the cell on the FinalData tab empty. If the name exits on both tabs then bring the surplus balance over from the SurplusBal tab into the SurplusBal coilumn on the FinalData tab. I have created named ranges for all columns on on the 6 tabs that get the data from the reports. I have been trying to use VLOOKUP to accomplish this but get either N/A or REF errors. Any assistance with this issue will be greatly appreciated. I apologize for this lenghy post.

    Thank you,
    Dave
    Last edited by NBVC; 10-06-2011 at 11:24 AM.

  2. #2
    Forum Guru Domski's Avatar
    Join Date
    12-14-2009
    MS-Off Ver
    What does it matter?
    Posts
    3,933

    Re: VLOOKUP Question

    Hi Dave,

    I would suggest a sample workbook illustrating your problem would greatly help.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

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

    Re: VLOOKUP Question

    You can either hard code the sheet name into a VLOOKUP for each column, or you can use the more volatile INDIRECT function to reference the sheetname in your headers indirectly so you can copy the formula down and across.

    E.g.

    =IFERROR(VLOOKUP($A2,INDIRECT("'"&B$1&"'!A:C"),2,FALSE),"")

    this looks up value in A2 of your current sheet (i.e. the Name) and finds it in the sheet that is named as per string in B1 and extract the corresponding value from the second column. If there is no match a blank is returned.

    you can copy formula down and across the columns.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  4. #4
    Registered User
    Join Date
    09-21-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLOOKUP Question

    Hi Dom,

    I have attached a sample spreadsheet. As you'll see there are 17 customers on the FinalData tab; I need to bring over the account number to the AcctNbr field on the FinalData tab (all customers have an AcctNbr) and then I need to populate the remainder of the columns on the FinalData tab where it finds data on the other 6 tabs. If it finds no data then leave the cell on the FinalData tab empty.

    Your help is appreciated.

    Thank you,
    Dave
    Attached Files Attached Files

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,608

    Re: VLOOKUP Question

    Some customers have multiple accounts. How do you want to deal with those?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  6. #6
    Forum Guru Domski's Avatar
    Join Date
    12-14-2009
    MS-Off Ver
    What does it matter?
    Posts
    3,933

    Re: VLOOKUP Question

    For the values entered in C2 and copied down and across:

    =IFERROR(VLOOKUP($A2,INDIRECT("'"&C$1&"'!A:C"),3,FALSE),"")

    Not sure about the account numbers as you don't have a single list of them to search.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  7. #7
    Registered User
    Join Date
    09-21-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLOOKUP Question

    Yes, I do need to deal with them as well. Thank you.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,608

    Re: VLOOKUP Question

    You list in column A of Final data, shows one of each customer... how do you want to deal with the AcctNumbers... pick the first one only? or what?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Registered User
    Join Date
    09-21-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLOOKUP Question

    Hi Dom,

    I think I made a mistake when creating the sample. My aplolgies. I have attacheed another sample spreadsheet.

    Dave
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-21-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Thumbs up Re: VLOOKUP Question

    Hello all.

    Thank you for your replies. I was able to figure it out. I had to create my formulas based on account numbers instead of customer name. The account numbers are unique. I also realized that I was not inculding all the data needed in my named ranges. Once I corrected my named ranges and created the formulas based on account number I had the results I needed.

    Once again, I apprciate your replies. These forums are awsome!

    Regards,

    Dave

+ 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.2.0