+ Reply to Thread
Results 1 to 6 of 6

How to copy a formula to multiple worksheets that references the previous worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    04-25-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    16

    How to copy a formula to multiple worksheets that references the previous worksheet

    I have a workbook with 31 identical worksheets, each representing a day of the month. I have several formulas I need to copy to those worksheets that refer to the previous day's worksheet (the one just before it.) If I copy the formula to all the worksheets, I have to go back to each one and change the worksheet name that the formula is referencing. Is there a way to make a formula reference the previous worksheet instead of an absolute worksheet?
    Last edited by robnsd; 12-26-2015 at 10:25 PM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to copy a formula to multiple worksheets that references the previous worksheet

    What version of Excel does this have to work in?

    What are the REAL sheet names?

    Are you simply referring to the same cell on the previous sheet? Like this:

    On Sheet2: =Sheet1!A1
    On Sheet3: =Sheet2!A1
    On Sheet4: =Sheet3!A1
    On Sheet5: =Sheet4!A1
    etc
    etc
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    04-25-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: How to copy a formula to multiple worksheets that references the previous worksheet

    Yes, referring to the same cell on the previous sheet. I have Excel 2007. My sheet names are D (1), S (1), G (1), D (2), S (2), G (2), etc. So in reality three different sheets for each day (Day, Swing and Grave.)

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to copy a formula to multiple worksheets that references the previous worksheet

    This is moderately complicated and may not be worth the trouble.

    The sheets that this applies to must be physically located to the left of any other sheets there may be. For example, the sheet index will have to be like this:

    \D (1)/\S (1)/\G (1)/\Master/\Notes/

    This technique uses a macro function so you must enable macros and the file must be saved in the *.xlsm file format.

    Create these defined names...

    Name: SheetNames
    Refers to: =GET.WORKBOOK(1)&T(NOW())

    Name: SheetNum
    Refers to: =GET.DOCUMENT(87)+NOW()*0

    Apply the formula...

    Let's assume you want to link to cell A1 from each previous sheet into cell A5 of the next sheet.

    Group the sheets together that you want this to apply to.

    Enter this formula in cell A5:

    =INDIRECT("'"&INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),SheetNum-1)&"'!A1")

    Make sure you ungroup the sheets after you're done!

    Here's a small sample file created in Excel 2007 that demonstrates this.
    Attached Files Attached Files
    Last edited by Tony Valko; 12-26-2015 at 05:31 PM.

  5. #5
    Registered User
    Join Date
    04-25-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    16

    SOLVED How to copy a formula to multiple worksheets that references the previous worksheet

    Tony,

    Thank you very much. That worked great and I will use it. It sure looks complex. Is there any purpose for the master and notes tab or is that use a good convention to use. I'd be curious how this works. What is the significance of the number 87 in one of the names.

    Robert

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SOLVED How to copy a formula to multiple worksheets that references the previous works

    Quote Originally Posted by robnsd View Post
    Is there any purpose for the master and notes tab or is that use a good convention to use.
    That is just to show how the sheets must be distributed. Those are totally random sheet names made up for the example.

    What is the significance of the number 87 in one of the names.
    87 is one of the argument numbers for the GET.WORKBOOK(...) function.

    1 = return an array of the sheet names
    87 = return an array of the sheet numbers

    This info is not included in modern versions of Excel.

+ 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. [SOLVED] How do I automatically fill a new worksheet with a previous worksheets data and formula?
    By daughty in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-10-2015, 11:40 AM
  2. Copy multiple lists from multiple worksheets into single worksheet
    By gowtham_pec in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2013, 04:44 AM
  3. Copy multiple worksheets into a master worksheet
    By shabbir2812 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-10-2013, 01:31 PM
  4. Copy from multiple worksheets into one worksheet
    By Christy416 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2008, 10:39 AM
  5. Copy different columns from multiple worksheets into 1 worksheet
    By dakke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2008, 05:50 PM
  6. [SOLVED] replace formula references with previous sheet names
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2006, 09:35 AM
  7. top worksheet -How do I copy a reference formula onto multiple worksheets
    By Nina@ramaz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-21-2005, 11:05 AM

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