Google-sheets – Stop circular dependency calculations unless a specific cell is edited

google sheets

I am trying to figure out how to get Google sheets to only calculate circular dependency when a specific cell is changed. What is happening now is that the calculation occurs every time anything is changed on the sheet.

What is happening now is that if A1 is supposed to add B1 to itself, it works. But, if I then change the value in B2, A1 adds B1 to itself again. Grrr. Very frustrating. Again, I only want A1 to add itself to B1 if B1 is changed.

And yes, I have circular dependency enabled.

Example formula placed in A1: =A1+B1

Best Answer

This is not possible but this could be done by using an on edit / on change Google Apps Script's trigger.

Example:

function onEdit(e){
  var sheet = range.getParent();
  if(range.columnStart === 2 && range.rowStart === 1) {
  sheet.range('A1').setValue(sheet.range('A1').getValue() + e.value);
}