A
A
Alexander Zharchenko2020-12-19 15:00:43
Google Sheets
Alexander Zharchenko, 2020-12-19 15:00:43

Google sheets. How to apply conditional formatting depending on the click of the checkbox?

The question is not just that if some cell returns false or true , then the state of other cells would depend on this status, this is simply done through a banal if-chip in Google spreadsheets. The question is that if the cell on which the rest depend has a certain status, then other cells could be easily changed.

Let's say that Cell1 returns true and Cell2 formula says to return true in this case.
But if Cell1 returns false , then I would like to be able to arbitrarily set Cell2 to true orfalse . And when Cell1 becomes true again , Cell2 will also assume the frozen state ture again . That is, I want to be able to modify the state according to my will with some selected state.

In practice, I would like to implement something like several checkboxes in Google Spreadsheets.
Several checkboxes become filled if one is filled, but if the first one is not filled, then I can arbitrarily mark a group of checkboxes as I want. Is it even possible?

I hope I explained clearly :3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2020-12-19
@exxxcitation1

Use onEdit ( event )

function onEdit(event) {
  //Возникает при изменении ячейки
  var ss = event.source.getActiveSheet();//Текущий лист
  	var address = event.range.getA1Notation().toUpperCase();//Адрес ячейки
  var row = event.range.getRow();							//Номер строки
  var col = event.range.getColumn();						//Номер столбца
  var newValue = event.value;								//Новое значение
  var oldValue = event.oldValue;							//Старое значение
  
  if (["Лист1","Лист2"].indexOf(ss.getName())==-1) return;	//Указываем на каких листах должен работать скрипт
  
  //Что-то делаем...
  };

If the value of the desired cell has changed from TRUE to FALSE , then change all other flags.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question