Forum Discussion
Tab Referencing
Carl_W I played with Riny_van_Eekelen 's solution to set up some alternatives. Since I am using Excel 365 it is likely that the initial changes that allow me to work with the formula makes it unusable for others. Firstly Riny's solution
= LET(
rowNum, Row,
colNum, XLOOKUP(Col,ColRef,ColNr),
sheetRef, XLOOKUP(Sheet,SheetCode,SheetName),
return, INDIRECT(
ADDRESS(rowNum, colNum,1,1, sheetRef)),
return)Then, I retained the INDIRECT, but used it to evaluate sheet-local names rather than direct cell references
= LET(
rowNum, Row,
colNum, XLOOKUP(Col,ColRef,ColNr),
sheetRef, XLOOKUP(Sheet,SheetCode,SheetName),
dataRange, INDIRECT(sheetRef & "!data"),
return, INDEX(dataRange, rowNum, colNum),
return)Next, I used CHOOSE as an alternative to the volatile function INDIRECT
= LET(
rowNum, Row,
colNum, XLOOKUP(Col,ColRef,ColNr),
sheetIndex, XMATCH(Sheet,SheetCode),
dataRange, CHOOSE(sheetIndex, MASTER!Data, ORDERS!Data, SUPPLIER!Data),
return, INDEX(dataRange, rowNum, colNum),
return)Passing the parameters as a Lambda function allows the details to be hidden within the function name, leaving the worksheet formula to read
= DATAλ(Row, Col, Sheet)The ultimate objective might be to use recursion over the sheet codes in order to return results from selected sheets as an array. By the time one finishes, not much remains as traditional Excel!