Formula with Dynamic Sheet Name Reference.

myfathersson

New Member
Joined
May 4, 2010
Messages
22
Hi.

I'm trying to come up with a formula that will allow me to sum values across multiple sheets where the sheet name is referenced by a wildcard or some such thing.

Situation:
I have a spreadsheet that is comprised of a summary sheet and a number of sheets each containing the timesheet for a given staff member. In the summary sheet there is a list of staff rate categories. The sheet totals the number of days worked for all staff in a given category, multiplies the total by the category rate giving the total cost for the category. Currently the timesheet sheets are named by the staff name (e.g., JBloggins) with the sheets pertaining to a specific category grouped together. The summary sheet formula looks like this:

Code:
=SUM(JBloggins:ZSmith!K22)

where the timesheet sheet for JBloggins is the first in the category set and ZSmith is the last. The formula totals all the values in cell K22 from sheet JBoggins to ZSmith inclusive. The problem is when resources come and go we have to insert/remove sheets from the appropriate category sheet set and update the formula, which is a pain.

Requirement:
I'd like to be able to do something like put the category name in the sheet name (e.g, Developer - JBloggins) and build a formula that sums the days for the category something like the following (understanding that the formula below would not work but it gives you the idea):

Code:
=SUM(Developer*!K22)

This way it wouldn't matter where a given timesheet occurs in the workbook. As long as the category name used in the sheet name is correct, the formula would total all sheets for the given category. I could add and remove timesheet sheets without concern that the formula has to be updated or the sheets are in the correct order.

I know I could do it using VBA but I'd rather not if I can avoid it.

Any ideas?

Peter
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I built something similar by listing the sheets that I wanted to sum and referencing them using INDIRECT. Your formula would look something like this (where Developer is a named range containing the list of sheets):
=SUM(INDIRECT("'"&Developer&"'!K22"))

If you can guarantee that your sheet names won't contain spaces, you can simplify this to:
=SUM(INDIRECT(Developer&"!K22"))
 
Upvote 0
Neil,

I'm not sure what the named range should be. Could you give me an example. I've tried a couple ways but none work so I must be missing something.

Peter
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top