+ Reply to Thread
Results 1 to 5 of 5

VLookup or VBA...

  1. #1
    Registered User
    Join Date
    05-24-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    29

    VLookup or VBA...

    From what I can tell, I would either need VBA or a TON of IF statement VLOOKUPS to accomplish what I am going for.

    I want to be able to lookup a certain sheet within a workbook based upon the date.

    I have the following cells (account1-511 is in cell B1 -- company1 is in cell A2)
    account1-511 account2-511 account3-511
    company1
    company2
    company3
    company4
    company5

    I want to be able to look up the value for company1 in account1-511. The account1-511 and other accounts will changed based upon the date. The date for the example given is 05/11. The account will be account1-611 for 06/11 and so on.

    So, when the date is (05/11) I want to look up company1 on SHEET named account1-511. When the date is (06/11) I want to loko up company1 on SHEET anmed account1-611...and so on.

    Possibly there is an easier way or different naming convention for the sheets that I may be able to use.

    I'm not positive how to even write this in VBA or if it can be done as explained. Any help is appreciated.

    Thank you.
    Last edited by NBVC; 08-31-2011 at 10:50 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: VLookup or VBA...

    Can you post a sample workbook?

  3. #3
    Registered User
    Join Date
    05-24-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: VLookup or VBA...

    This should be a sample for you, I think that I attached what I need to.
    Attached Files Attached Files

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLookup or VBA...

    Try this formula:

    =VLOOKUP($A9,INDIRECT("'"&B$8&"'!A:B"),2,0)

    copied down and across the matrix.
    Where there is a will there are many ways.

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

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

  5. #5
    Registered User
    Join Date
    05-24-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: VLookup or VBA...

    Quote Originally Posted by NBVC View Post
    Try this formula:

    =VLOOKUP($A9,INDIRECT("'"&B$8&"'!A:B"),2,0)

    copied down and across the matrix.
    Absolutely PERFECT!!!

    Thank you so much.

+ 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