Forum Discussion
Dynamic Definition of Tablename or Table Reference
Hi all,
my Workbook contains n+1 Worksheets.
The n Worksheets are data dumps such as Jan-22, Feb-22, Mar-22 and so on
The +1 Worksheet represents an analysis / consolidation Worksheet.
On the Analysis-Sheet there is one column for each month, summarising data from the corresponding data dump. Meaning the column Jan-22, e.g., summarise the amount of items in total, how many of them fulfilled a certain criteria (e.g. deadline overdue), etc.
Therefore, the summation of each column on the Analysis-Sheet needs to refer to a different worksheet (Column Jan-22 refers to Worksheet Jan-22, Column Feb-22 refers to Worksheet Feb-22 and so on). Making use of the INDIRECT-formula allowed me to put the required Data-Worksheet in as a variable. This allowed me further to copy and paste my formulas from one column to another on the analysis-Sheet, which would not be possible otherwise, as I would have to replace the required Data Dump's-Worksheet name in each column.
Unfortunately, this is very vulnerable to changes in the data dump structure. Therefore, I'd like to set up the data dumps as TABLES and refer to their HEADINGS. However, in my attempts of doing so, I was not capable of combining TABLE-names with INDIRECT or any other formulas, so that the TABLE name can be plugged into the formula as a variabel or cell reference.
Let's say the Data Dump in Worksheet Jan-22 ist set up as a TABLE and named "Data_Jan22" and the Table contains a header called "Deadline". The Table contains 200 entries.
In the Analysis-Sheet, I would have a formula such as
=COUNT(Data_Jan22[Deadline])
The formula would work just fine. But when I want to apply the same formula to the February-Data Dump, I needed to replace The Table Name "Data_Jan22" with "Data_Feb22". In order to avoid the need to adjust all formulas manually, I'd like to replace the Tables Name by a variable or cell reference.
Let's say these variables are available in the Analysis-Sheet's first row, e.g.
cell B1 = Data_Jan22
cell C1 = Data_Feb22
and so on
The above mentioned (rather rigid) formula =COUNT(Data_Jan22[Deadline]) should be made dynamical such that the table's name is inserted as a cell reference, such as
=COUNT(B1&[Deadline])
at least that should be the idea.
Unfortunately, the syntax is obviously wrong and I haven't grasped the syntax sufficiently, yet, in order to transform my idea in a working formula. I hope you can help me understand how I can replace parts of a Table Name and Column Indication by cell references, so that a formula can be copied and extended without the need of manual adjustments.
Thanks a million for all your regards and helpful advices.
cheers
david
4 Replies
- Riny_van_EekelenPlatinum Contributor
- DSchizzle-RockCopper ContributorThanks Riny_van_Eekelen. That was exactly what I needed. I am really impressed how exact you understood the problem (I wasn't sure if my description was understandable or not) and how quickly you responded to it!. Many, many thanks. Your's and Rsartori's responses were really the two things today worthwhile. Have a good time. Many thanks again and cheers! David
- Rsartori76Brass ContributorUse INDIRECT with COUNT
=COUNT(INDIRECT(B1&"[Deadline]"))- DSchizzle-RockCopper ContributorThanks Rsartori76. That was exactly what I needed. I am really impressed how exact you understood the problem (I wasn't sure if my description was understandable or not) and how quickly you responded to it!. Many, many thanks. Yours and Riny's responses were really the two things today worthwhile. Have a good time. Many thanks again and cheers! David