+ Reply to Thread
Results 1 to 3 of 3

Possible to have a component of a formula reference text in a cell?

  1. #1
    Registered User
    Join Date
    01-18-2011
    Location
    U.S.
    MS-Off Ver
    Excel 2007-10
    Posts
    5

    Possible to have a component of a formula reference text in a cell?

    So let's say I have this formula:

    VLOOKUP(Name,'I:\drive\picnic\folder\[5 May 2011 Timings.xlsx]May 2011'!$A$1:$A$150,8,FALSE)

    Basically a formula that returns the value corresponding to "Name" in the 8th column of a worksheet in a specified folder.
    Now let's say I have a lot of these formulas in cells in the same sheet. I have created a VBA code that when I click a button I get prompted to select a workbook file and this code pastes the reference to that file with the appropriate reference to the sheet within the workbook in a specific cell. Let's say this cell is "G2".

    Now I want to rewrite my formula so that it references the cell "G2" like so:

    VLOOKUP(Name,G2,8,FALSE)

    where this is contained in text in G2:
    'I:\drive\picnic\folder\[5 May 2011 Timings.xlsx]May 2011'!$A$1:$A$150


    So this looks like this should work to me, except that it doesn't. Does the text within G2 have to be a certain format?
    Any help on this would be greatly appreciated. Thanks!

  2. #2
    Forum Contributor bentleybob's Avatar
    Join Date
    02-27-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    644

    Re: Possible to have a component of a formula reference text in a cell?

    Did you try using INDIRECT(G2) in your lookup formula?

  3. #3
    Registered User
    Join Date
    01-18-2011
    Location
    U.S.
    MS-Off Ver
    Excel 2007-10
    Posts
    5

    Re: Possible to have a component of a formula reference text in a cell?

    Thank you for the suggestion. I played with it for a while but sadly I get reference errors when I use it. I'm thinking I may just make the macro search through and change the reference itself.

+ 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