In SHEET2
in cell A1
, add the following formula:
=IF(AND(Sheet1!A1="s";Sheet1!B1="s";Sheet1!D1="s";Sheet1!F1="s");"s";"invalid")
Is says:
If A1, B1, D1 and F1 in sheet 1 all contain an s then write s else write invalid
Custom functions are re-run when their parameters change. For example, if you have =myfcn("sheetname", 1, 1, 1, 1)
and change some of parameters here, the function will run again. But if you go and change the content of cell sheetname!A1, the function will not re-run, since there is no indication in the spreadsheet that its output depends on sheetname!A1.
Alternative
To get all formulas from a sheet into another sheet as text, use a script function like this:
function copyFormulas() {
var sheet = SpreadsheetApp.getActiveSheet();
if (sheet.getName() == 'Watched Sheet') {
var data = sheet.getDataRange();
var target = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Formulas');
target.getRange(1, 1, data.getHeight(), data.getWidth()).setValues(data.getFormulas());
}
}
The function takes formulas from 'Watched Sheet' and puts them into 'Formulas' sheet as text. This script can run periodically, or on every edit, or on every change (including adding rows, etc). See triggers.
Best Answer
You can use the following script to get the sum from multiple sheets:
UPDATE
Because the script is only executed at an interval of 5 minutes, and an OnEdit trigger won't work, I had to revise the answer I gave in order for it to be practical. See revision history to notice the differences.
The first part
will set the spreadsheet and create an extra menu option, called
Sum
:The second part
will ask for a starting position and collect the total number of sheets and will determine the position of the
Result
sheet (not sheet ID but the absolute position). After which it will open each consecutive sheet starting from thefirst
parameter (zero based !!), to gather the values and add them to the sum, till it hits theResult
sheet. At the end, the total sum is added to any active cell:To trigger the calculation, press
get sum
from the menu optionSum
and the result will be added.See example file I've prepared: SUM throughout multiple sheets