+ Reply to Thread
Results 1 to 4 of 4

Variable/Dynamic Sheet Reference in Formula!?! HELP!

  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    Tetbury, England
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    73

    Exclamation Variable/Dynamic Sheet Reference in Formula!?! HELP!

    Hi All,

    Not sure my title is the best way to describe my problem; so i'll explain...

    Basically, what I want to achieve is a way of, rather than have to type out loads of formulas, or copy the formula out to something like word, do a find and replace and then paste back, that I can reference a SHEET name in a formula by using the TEXT contained in a cell reference of my choosing.

    Example...
    • I have Created a Sheet Called EPL
    • I have a formula, for example =EPL!A1

    Then what I want is, if I create a new sheet called say...ECH...to have a way of not having to update all my formulas to have ECH! in rather than EPL!...

    SO...my thought (not sure if it's the best) was to have a hidden column in the sheet where the formula is, with EPL or ECH in the cells, and then a way that the formula would search a sheet with the name in that cell and then the range as per normal...

    To illustrate...

    =EPL!A1 might become (in principle, not written correctly as i don't know how!)...=A1!A1...the first A1 being the cell on this sheet which is dictating the name of the sheet to search in.

    Now, I realize this will mean me being VERY careful with how I name my sheets and what i type in my hidden column, but that's something i'm okay with...just need a way to do what I'm after!

    I hope this makes sense, just in case I have created a sample spreadsheet showing what i mean...

    Thanks in advance guys!!



    Chris

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Variable/Dynamic Sheet Reference in Formula!?! HELP!

    Hello,

    you can use the Indirect function for that. In C2 enter

    =INDIRECT(A2&"!A1")

    and copy down.

    Note that Indirect() is volatile and will cause recalculation of your whole workbook when any cell is changed. This can lead to dramatic slowdown of a workbook. Indirect should be avoided.

    If you present your wider context we can probably come up with a different approach that is more robust.

    cheers, teylyn

  3. #3
    Registered User
    Join Date
    07-26-2012
    Location
    Tetbury, England
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    73

    Re: Variable/Dynamic Sheet Reference in Formula!?! HELP!

    Hi Teylyn!

    Thanks so much for the response; apologies it took me so long to get back been away from the project for a few days with work.

    Well, the basis of it is that I have many different teams in my business for which i'm responsible for analyzing for the business. They all have their own tab (hence the sheet name query originally). On their own tabs they're measured on a range of performance measures. This is then collated and compared on the front sheet. The reason indirect (or something similar) was useful was I could just update the team name in one column, and the same formula would then return or calculate based on the same range on a different sheet.

    Your indirect idea does seem to work thus far in my own small tests...my question though is how would I apply that indirect formula to this formula!?

    Please Login or Register  to view this content.
    Thanks Teylyn! Lemme know if you need an example with the above range populated with data for a test your end!

    Thanks!


    Chris

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Variable/Dynamic Sheet Reference in Formula!?! HELP!

    Well, since you're asking ....

    I'd throw away the setup that forces you to use a formula like that in the first place, and I would definitely not spike up this formula with indirect.

    Although you could, e.g. put the sheet name "EPL" into A1 and then replace each instance of EPL!A:A with indirect(A1&"!A:A") -- adjust columns as required.

    I'd probably re-organise the architecture of the workbook. Whenever I read something like "I have one sheet for each team/month/year/product/category" my alarm bells go off. That architecture edits data in a report. You are facing the problems you get when you want to consolidate multiple reports (i.e. sheets) into one "master" report.

    If at all possible, try to put all raw data into one sheet. Just one. You may have to add a column for the team name.

    Then you can build a report on one (as in one) other sheet, where you pull data from the raw data sheet with the help of pivot tables and/or formulas. Use filters and/or slicers to select a specific team or don't filter and see the report for all items.

    You may actually need another report sheet that has a summary of the total values, whereas the team report concentrates more on details per team.

    Just throwing that in there as food for thought.

    cheers, teylyn

+ 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. Using INDIRECT formula to reference a dynamic range on another sheet
    By Travisty in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-01-2018, 12:22 PM
  2. [SOLVED] Replace a cell reference in a formula with dynamic reference
    By jkj115 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2016, 11:04 AM
  3. [SOLVED] Variable sheet name reference not working in VBA formula?
    By fourmurphys in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2016, 12:09 PM
  4. Replies: 1
    Last Post: 05-06-2013, 05:20 PM
  5. Use of Variable Sheet Name in VBA Formula - Update Reference
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2010, 03:20 AM
  6. Dynamic reference to a sheet
    By Biff in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 06:05 AM
  7. [SOLVED] Dynamic reference to a sheet
    By xisque in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

Tags for this Thread

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