Using Excel Checkboxes
Checkboxes are simple and convenient to use (including with functions).
A checkbox returns TRUE when checked and FALSE when unchecked.
Insert Checkboxes
Select the cells where you want to insert checkboxes and click on "Checkbox" from the "Insert" tab:

Preview:

You can simultaneously toggle several checkboxes by highlighting them and hitting the spacebar.
Using with Functions
To display a result based on a checkbox, use the IF function.
In this example, the number 30 will be displayed if the checkbox is checked:
=IF(B2,30,"")

A checkbox returns TRUE or FALSE, so you can directly enter the checkbox reference as the condition of the IF function.
If needed, you can download the Excel file used here: checkbox.xlsx