Replace table name in formula with variable

macfoo

New Member
Joined
Oct 19, 2015
Messages
11
I'm using Microsoft's Employee Absence Schedule template for tracking.

There are references to tblMonthName that look like this in formulas

tblJanuary
tblFebruary
tblMarch

and so on.

An example of one of the formulas looks like this:

=COUNTIF(tblJanuary[@[1]:[31]],"V")

Because of some modifications I am doing (like the one above), I'd like to know if there is a way to make this dynamic, in determining the "table name" from the sheet that you are on.
Even better would be if it could also dynamically determine the "day range" of the month.

I tried concatenate for the table name in another cell (since the month name is provided in the sheet in a set cell across all 12 months) but was unable to figure out how to get it to work within the formula.

Thanks in advance
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hey man,

this formula will give you the current sheet name (as long as the workbook is saved.)

Code:
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))

then you could use Indirect to give you the function you had in the result of the formula you have above.

Code:
=COUNTIF(INDIRECT(RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))&"!"&"1:31"),"V")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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