+ Reply to Thread
Results 1 to 4 of 4

Can I use column() in the sheet name inside a vlookup?

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Question Can I use column() in the sheet name inside a vlookup?

    Hi, I have this formula: =VLOOKUP($A2,'[Worked Data.xlsx]1'!$D$2:$D$65000,1,FALSE)

    Which references a workbook called 'Worked data.xlsx' and this has a series of worksheets '1' '2' '3' etc.

    I would like the formula to increment the sheet name by 1 each time it is copied/filled one column to the right.

    I've tried using column() to return a number that varies by column, which I have used in the past to increment the column number that is being referenced, but it didn't work when referencing a sheet name (or I didn't use the correct syntax).

    I guess I could create forumula to create a text string using the fixed string "[Worked data.xlsx]" and the column() function and then insert this into the vlookup, but I have no idea how is should be written, or if it's possible.

    Any suggestions?

    Many thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Can I use column() in the sheet name inside a vlookup?

    You can solve it by using =Indirect().
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Registered User
    Join Date
    03-20-2012
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Can I use column() in the sheet name inside a vlookup?

    Thanks,

    I used

    =VLOOKUP($A2,INDIRECT("'[Worked Data.xlsx]"&(COLUMN()-5)&"'!$D$2:$D$65000"),1,FALSE)

    Which has worked - the formula is in column F.

    Scott.

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Can I use column() in the sheet name inside a vlookup?

    You are very welcome.

+ 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