+ Reply to Thread
Results 1 to 5 of 5

static formula possible?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2014
    Location
    washington DC
    MS-Off Ver
    2010
    Posts
    2

    static formula possible?

    I have a macro that generates several tabs of lookup tables. The tabs are named (lets say "table 1", "table 2", etc...). In my main worksheet, I have a lot of formulas that reference their respective tables. The problem is the worksheet itself works like a template and the tabs are not generated until the macro runs so the formulas do not have a reference point (=VLOOKUP(A1,#REF!A:B,2,FALSE). Is there a way to lock in the tab name into the formula?

    tldr - my formula is =vlookup(A1,table1!A:B,2,False) but the table1! turns into #REF! because the tabs are not generated until the macro runs.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: static formula possible?

    Hi,

    Try

    Formula: copy to clipboard
    =VLOOKUP(A1,INDIRECT("Table1!A:B"),2,False)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: static formula possible?

    Also, if you have formulas (whether normal or the INDIRECT Variety) that reference worksheets that don't exist yet, you can suppress the "errors" that result with an IFERROR wrapper.

    =MyVlookupFormula
    becomes
    =IFERROR(MyVlookupFormula, "")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    10-30-2014
    Location
    washington DC
    MS-Off Ver
    2010
    Posts
    2

    Re: static formula possible?

    i really appreciate the help. This was exactly what i was looking for.

    thanks

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: static formula possible?

    As it appears you've reached a conclusion, I've marked this thread SOLVED for you.
    FYI, this is done through the Thread Tools located above the first post in this thread. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 08-12-2013, 08:38 AM
  2. Replies: 2
    Last Post: 08-12-2013, 06:19 AM
  3. Excel 2007 : Formula copy with static value in it
    By ebmaurer in forum Excel General
    Replies: 1
    Last Post: 12-23-2008, 11:07 PM
  4. Static left hand side column and static header row.. how?
    By glic in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2007, 01:45 AM
  5. [SOLVED] static time in formula
    By sklomstad in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-17-2006, 02:10 PM

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