I am trying to find a function that selects from a certain cell from all spreadsheets. For example, I want to calculate AVERAGE('Sheet1'!B3, 'Sheet2'!B3, 'Sheet3'!B3)
, but I don't want to explicitly write SheetX
, I am rather looking for something like AVERAGE('allsheets':B3)
The reason I am doing this is that I would like the average to be recalculated whenever I add a new sheet.
I am using Google Spreadsheets, I am sure I can write a script to do that, but I think such a trivial problem might have a solution already.
Best Answer
Assuming you meant 'selecting from a certain cell from all sheets' (in one spreadsheet), custom function written in GAS that does that could look like this:
Fomula to be entered in the sheet is
example:
However, as custom functions like that seem to suffer from memoization, it will probably not auto-update after adding a sheet. There are workarounds, e.g. adding a dummy parameter, let's say the content of a certain cell that when incremented 'forces' a recalculation of the formula)