問題描述
如何檢查 Google 工作表上的兩個複選框? (How can I check the two checkboxes on Google sheet?)
image <‑ 我有一張像照片中一樣的谷歌表格。當我在這裡選中汽車後面的框時,該汽車的名稱會寫在結果部分中。我希望當我勾選兩個複選框之一時,另一個不會被選中。也就是說,一次只能選擇兩個複選框中的一個。當一個被選中時,另一個不應被選中。如何在不編寫應用腳本代碼的情況下使用谷歌表格公式解決這個問題?
image2 <‑ D2單元格中的公式:
=IFS(COUNTIF(A2, TRUE),B2,COUNTIF(A3, TRUE),B3,COUNTIF(A2, False ),"",COUNTIF(A3,
參考解法
方法 1:
One checked checkbox at a time (similar to a radio button behavior) isn't actually supported in Google Sheets at the moment.
However, there are certain ways to circumvent this kind of issue. It can be via Apps Script
or Sheets
itself.
Since you are looking for a Sheets
related solution, an alternative would be using an in‑cell dropdown instead of checkboxes. That way, you could only select just one car at a time and you don't need complex formula to get the chosen value itself, you just need to set the cell formula to =B2
to get the dropdown chosen value.
Sample:
To add a dropdown in Sheets
, see the reference below:
Reference:
參考文件