Google-sheets – how to auto calculate values

google sheets

I'm new to Google Sheets and I need help.

I want to create a "calculator" working on that base:

  • I enter a number in a case for example A3
  • It will take that number and subtract 50% of the value in the case B1 to this value (A3).
  • And then subtract that value to the number in A1.

So it will be: A1 – (A3-50% of B1) and then the case A3 will auto clean for the next operation.

I don't know if it is possible so I'm asking you.

Best Answer

to calculate it you need:

=A1-A3-B1*50%

to ensure no errors, final formula would be:

=IF(AND(ISNUMBER(A1);
        ISNUMBER(B1);
        ISNUMBER(A3)); A1-A3-B1*50%; )

and for clearing A3 you can use this script assigned to the button so you can clear A3 with a click:

function moveValuesOnly1() { var ss = SpreadsheetApp.getActiveSpreadsheet();
                             var source = ss.getRange("Sheet1!A2");
                             source.copyTo(ss.getRange("Sheet1!A3"), 
                             {contentsOnly: true}); }

demo spreadsheet: https://docs.google.com/spreadsheets/d/

1