SOLVED

Sum across multiple sheets when adding sheets with dynamically changing sheet names?

Brass Contributor

Not sure if I am trying something that is impossible?  I have a timesheet tracking workbook.  Each sheet's name changes dynamically to a job number, when I enter the job number into a cell at the top of each individual sheet.  

Example below... update cell E2 to "MJN Job 3" the sheet is automatically named "MJN Job 3"

Budman361530_0-1632267612224.png 

Budman361530_1-1632267724103.png

Currently I have 10 sheets in my work book.   We have grown past this, and some weeks we have well over 10 jobs.  I want to make a Macro to add sheets.  That part is easy.  However, all the sheets total on one summary sheet.   My current code in the summary sheet is simple...(example above) ='test test'!D42+'MJN 21MJNtest'!D42+'MJN Job 3'!D42... etc.   

Can I, or is it possible to have a formula that would know to grab/add all of Cell D42's, from what ever sheets are between let's say sheet "MJN Job 1", and sheet "MJN Job 100"... depending how many sheets I may add?

 

 

 

 

3 Replies
best response confirmed by Budman361530 (Brass Contributor)
Solution

@Budman361530 

Add the sum formula into the desired cell

  1. Left click on the FIRST sheet with the mouse.
  2. Hold Shift key and left click on the LAST sheet. Now select the cell D42 in the LAST sheet. Add a closing bracket to the formula and press Enter. Your sum formula should now look like this.

Considering the names you gave us, your formula will look like that

=SUM('test test:MJN Job 3'!D42)

In other words

 

 

=SUM('FirstSheet:LastSheet'!D42)

 

 

Replace FirstSheet and LastSheet with the worksheet names you wish to sum between.

 

We can change this to be more dynamic, making it even easier to use. Instead of using the names of the first and last sheets, you can create two blank sheets to act as bookends for your calculation. 

 

JulianoPetrukio_1-1632271636535.png

 

 

Ugh!!!! I was so close. I had two extra " ' " (apostrophes) in my equation. I was typing =SUM('first sheet':'last sheet'!D42) and could not figure out why that wasn't working. Was wondering if it just couldn't be done. Works now... thank you!! Have an awesome day!
how do you do that? I have a sheet that I'm trying to create multiple date sheets
ie. date at the top creates a tab with new date
1 best response

Accepted Solutions
best response confirmed by Budman361530 (Brass Contributor)
Solution

@Budman361530 

Add the sum formula into the desired cell

  1. Left click on the FIRST sheet with the mouse.
  2. Hold Shift key and left click on the LAST sheet. Now select the cell D42 in the LAST sheet. Add a closing bracket to the formula and press Enter. Your sum formula should now look like this.

Considering the names you gave us, your formula will look like that

=SUM('test test:MJN Job 3'!D42)

In other words

 

 

=SUM('FirstSheet:LastSheet'!D42)

 

 

Replace FirstSheet and LastSheet with the worksheet names you wish to sum between.

 

We can change this to be more dynamic, making it even easier to use. Instead of using the names of the first and last sheets, you can create two blank sheets to act as bookends for your calculation. 

 

JulianoPetrukio_1-1632271636535.png

 

 

View solution in original post