When trying to Run the following script the result is always a #NUM! error - (Result is not a number) in cell "O5"

Both the cells are in currency format and I've tried changing them to number as well but still the same error pops up.

function substract(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var dash = ss.getSheetByName('Dashboard');
  var a = dash.getRange("O5").getValue;
  var cash = ss.getSheetByName('Open Trades');
  var b = cash.getRange("M4").getValue;



Underlying context : -I want to create a script function that I will use with daily triggers:

-function will subtract "Daily Fees" (a cell value that changes daily from "Open Trades" sheet) / from "Cash" (a cell in another sheet "Dashboard") and will set the value of the remaining Cash in the same cell (Cash from Dashboard)

Formula -> 'Dashboard'!O5 = 'Dashboard'!O5 - 'Open Trades'!M4

Thanks for any ideas!


1 Answer 1


Those Range.getValue() calls are missing their parentheses ().

  • Thanks! did not notice that! Script works now. Jan 23, 2022 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.