Currently Google Spreadsheets don't have a built-in function to get the formula from another cell but you can use Google Apps Script to create a custom function that will do it.
Example:
/**
* Devuelve la fórmula de la referencia especificada
*
* @param {string} reference Referencia en formato "A1"
* @customfunction
*/
function getFormula(reference) {
return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
.getRange(reference).getFormula();
}
Responsive adaptation so that instead of working with it =getFormula("A1")works with =getFormula('Hoja 1'!A1)in such a way that it can be applied by dragging and dropping to multiple cells.
/**
* Devuelve la fórmula de la referencia especificada
*
* @param {'Hoja 1'!A1} reference Referencia en 'Nombre Hoja'!Celda
* @customfunction
*/
function getFormula(reference) {
var sheet = SpreadsheetApp.getActiveSheet();
var formulaCelda1 = sheet.getActiveRange().getFormula();
var celda2 = formulaCelda1.match(/=\w+\((.*)!(.*)\)/i)[2];
return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(celda2).getFormula();
}
Currently Google Spreadsheets don't have a built-in function to get the formula from another cell but you can use Google Apps Script to create a custom function that will do it.
Example:
Reference
Responsive adaptation so that instead of working with it
=getFormula("A1")
works with=getFormula('Hoja 1'!A1)
in such a way that it can be applied by dragging and dropping to multiple cells.See reference example.