Google Sheets Formula – How to Use isFormula

formulasgoogle sheets

Is there a function that will tell if a specific cell has a plain (manually entered) value or has a formula?

Best Answer

With this little snippet you can do that.

Code

function isFormula(startcol, startrow) {
  // prepare string
  var str = String.fromCharCode(64 + startcol) + startrow;

  // retrieve formula
  var fCell = SpreadsheetApp.getActiveSpreadsheet()
    .getRange(str).getFormula();

  // return false if empty else true 
  return fCell ? true : false;
}

Usage

enter image description here

In this answer, Tom Horwood found a way to circumvent the usage of quotes.

Example

Add the script under Tools>Script editor and press the bug button to activate the authentication.

I've created an example file for you: Check for Formula