I have two sheets in my workbook:
- In
sheet1
in cell_1 by addresssheet1!A1
I store my data. - In
sheet2
in cell_2 by addresssheet2!A1
I have the formula=sheet1!A1
.
So the value of cell_2 always mirrors the value of cell_1. And the formula in cell_2 dynamically changes when I drag cell_1 on sheet1
or rename sheet1
(for example: '=sheet1!A1' transforms to '=newSheetName!B2').
I won’t get 'sheet name' 'N of column' and 'N of row' of cell_1 from the formula in cell_2. N of column I get by COLUMN(cell_1) and N of row I get by row(cell_1). To get the sheet name I tried a macro:
function getSheetName (link_to_my_cell){
var myformula = link_to_my_cell.getFormula(); // and later I get sheet name by the myformula
return (mySheetName);
}
When I then set the cell_3 formula to =getSheetName(link_to_cell_1)
it worked but if I rename sheet1
this method does not refresh the value of cell_3. It works properly only if I start function getSheetName
by trigger, maximum once per minute.
How can I get the sheet name in cell_3 from a formula in cell_2 'on the fly'?