'Display text based on multiple checkbox selection

I'm currently trying to figure out how to display predefined texts based on checkbox selections (multiple) in Google Sheets.

Example:

Checkbox 1 True
Checkbox 2
Checkbox 3 True

Predefined answers:

Answer 1
Answer 2
Answer 3 

Result:

  • Displaying the strings of Answer 1 + Answer 3 in a textbox.
  • If Checkbox 2+3 are checked, text of answer 2+3 should be shown inside a textbox.

Any idea how to make that happen?

Another exmaple in the picture: Example



Solution 1:[1]

You can do the same thing with onedit trigger

function onEdit(e) {
  //e.source.toast("onEdit");
  const sh = e.range.getSheet();
  if(sh.getName() == 'Sheet0' && e.range.columnStart == 1) {
    sh.getRange('D1').setValue(sh.getRange(1,1,sh.getLastRow(),2).getValues().filter(r => r[0]).map(r => r[1]).join(','));
  }
}

The ouput is the string in col2 where col1 is truthy

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1