Forms, fields and formulas

How do I count how many checkbox options a user selected?

Add a Number field computed with Checkbox_Field.length().

How-to

Short answer: Add a Number field and compute it with Checkbox_Field.length().

Why it happens

Checkbox, multi-select and checklist fields hold a list of values. The length() method returns how many items are selected. See list expressions.

How to fix it

  1. Add a Number field to the form.
  2. Turn on Is this a computed field? to open the formula builder.
  3. Enter Checkbox_Field.length(), replacing Checkbox_Field with your checkbox field's ID.
  4. Click Evaluate to test it, then Save.

Related list methods:

  • To check whether one option is selected, use Checkbox_Field.has("Option") inside an IF.
  • To check that several options are all selected, use Checkbox_Field.hasAll("Option 1", "Option 2").
  • To show the selected options as text, compute a Text field with Checkbox_Field.concatenate(", ").
  • To read one selected option, use Checkbox_Field.get(1). Positions start at 1.

Tip

To make users pick a set number of options, add the Min number of selections or Max number of selections validation to the checkbox instead.

Related answers