Sub topic 7
Use Checkboxes as a Validated Input
Assume you can select ranges, open the Data validation panel, and write basic formulas. A checkbox is a cell control with two possible states: checked or unchecked. In Google Sheets, a checkbox is also a data-validation rule. It limits the cell to those two states instead of allowing arbitrary text.
Checkboxes work well for tasks, approvals, attendance, feature flags, and yes/no questions.
Add a checkbox
- Select the cells that should contain checkboxes, such as
C2:C100. - Choose Insert > Checkbox.
- Click a checkbox to switch it between checked and unchecked.
You can also open Data > Data validation and choose Checkbox as the criterion. This approach gives you access to additional rule settings.
By default, an unchecked box has the Boolean value FALSE, and a checked box has the Boolean value TRUE. A Boolean value is a value that is either true or false.
For example, if C2 contains a checkbox, this formula displays a task status:
=IF(C2, "Done", "Not done")The formula treats a checked box as TRUE and an unchecked box as FALSE.
Use custom checkbox values
The default values are useful for formulas, but you can replace them with your own values. For example:
- Checked:
Approved - Unchecked:
Pending
To configure this:
- Select the checkbox cells.
- Open Data > Data validation.
- Set the criterion to Checkbox.
- Enable Use custom cell values.
- Enter the checked and unchecked values.
- Save the rule.
The cell displays a checkbox, but its underlying values become Approved and Pending. A formula can then test the checked state explicitly:
=IF(C2="Approved", "Ready to publish", "Needs review")Custom values are useful when another formula, export, or connected system expects specific words. They are less convenient when you want simple Boolean logic, so choose one convention for the whole input area.
Connect checkboxes to other cells
A checkbox can control a formula, filter, or conditional format. For example, suppose:
| Task | Done | Display |
|---|---|---|
| Send invoice | `TRUE` | Done |
If B2:B100 contains default checkboxes, a separate cell can count completed tasks:
=COUNTIF(B2:B100, TRUE)You can also filter a list using a checkbox. If E2 is a checkbox and A2:C100 contains tasks, this formula shows only completed rows:
=FILTER(A2:C100, B2:B100=TRUE)When using custom values, replace TRUE with the checked value, such as "Approved".
Common errors and limits
A checkbox does not protect the entire row. It validates only the cells where the rule exists. If you add new rows outside the validated range, those rows may not have checkboxes.
Pasting can also replace or remove validation. Depending on the paste operation, pasted content may bring its own values or rules. Check the target range after importing or pasting data.
Do not compare Boolean values to quoted text unless you intentionally use custom values. TRUE is a Boolean value, while "TRUE" is text. For default checkboxes, use:
=B2=TRUEFor custom values of Yes and No, use:
=B2="Yes"Use Data > Data validation to edit a checkbox rule, change its custom values, or remove the rule. Removing the rule does not necessarily erase the values already in the cells.
Exercise
Column B contains default checkboxes for completed tasks. Write a formula that counts the checked boxes in B2:B100.
Show answer
=COUNTIF(B2:B100, TRUE)