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;
dash.getRange("O5").setValue(a-b);
}
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!