Ask Your Question
0

What is the method for using appscript to produce "true" beside the cell when the value of an IF formula changes from false to true?

asked 2021-12-28 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-01-18 22:00:00 +0000

huitzilopochtli gravatar image

You can use the onEdit() trigger of Google Apps Script to capture changes in the sheet and then use a conditional statement to check if the value of the cell has changed from false to true. If the condition is met, you can set the adjacent cell value to "true" using the setValue() method. Here's a sample code:

function onEdit(e) {
  var sheet = e.source.getActiveSheet();
  var range = e.range;
  if (range.getColumn() == 1 && range.getRow() > 1 && range.getValue() == true && range.offset(0, 1).getValue() == false) {
    range.offset(0, 1).setValue("true");
  }
}

This code checks if the edited range is in column 1 (change this as per your requirement) and the value of the cell has changed from false to true. If the condition is met, it sets the adjacent cell value to "true". You can modify the code as per your specific requirements.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-12-28 11:00:00 +0000

Seen: 9 times

Last updated: Jan 18 '22