Forum Discussion
Automatically change tables based on data from one cell.
The formula you posted can be changed by replacing these references:
Rota14[[MON]:[SAT]]
with
INDIRECT("Rota" & $CP$18 & "[[MON]:[SAT]]")
and
Rota14[[#Headers],[MON]:[SAT]]
with
INDIRECT("Rota" & $CP$18 & "[[#Headers],[MON]:[SAT]]")
(The spaces around the ampersands are not required; I included them to improve readability.)
The built-in function INDIRECT takes a string value that you construct (in this case using literals, the ampersand operator, and an absolute reference to CP18) and evaluates it as an address or reference. Microsoft describes it here, but you might find this article more meaningful, or you can search for some online videos that explain it.
BTW, the function can also work with references to cells/ranges/tables on a different worksheet or in a different (already-open) workbook.