CONTAINS Function:Calculation using Check Boxes and Multi-Choices

CONTAINS function enables you to use check boxes and multi-choices in formulas.
You can also use it with IF function.

Using CONTAINS Function

CONTAINS(Field_code, Option name)

It returns TRUE if the specified option ("Option name") is selected in the specified field ("Field_code"). Otherwise, it returns FALSE.
  • As the first argument, specify a field code for a check box or multi-choice.
  • As the second argument, specify an option name that is enclosed with double quotation marks (").

Formula Examples

This section shows you some examples of formulas using CONTAINS function. You can use this as described below.

Formula: IF(CONTAINS(Check_box, "completed"),"Checked","Unchekced")

It displays "Checked" if "completed" check box field is selected. Otherwise, "Unchekced" is displayed.
Formula:
IF(CONTAINS(workday, "Sunday"), "Sunday work", "No Sunday work")


It displays "Sunday work" if Sunday is selected in the work field. Otherwise, "No Sunday work" is displayed.
Formula:
8000+IF(CONTAINS(Lodging_Options, "Breakfast available"), 1500, 0)


It displays the sum of fees for the accommodation 8,000 yen and breakfast 1,500 yen if "Breakfast available" is selected in the "Lodging Options" field. Otherwise, it displays 8,000 yen.
Formula:
IF(OR(CONTAINS(Workday, "Saturday"),CONTAINS(Workday, "Sunday")), "Working on Holidays", "")


You can combine AND function with OR function to write multiple conditions.
In this example, it displays "Working on Holidays" if "Saturday" or "Sunday" is selected in the "Workday" field.
Formula:
IF(AND(CONTAINS(checking, "A"),CONTAINS(checking, "B"),CONTAINS(checking, "C")),"Checked","")


It displays "Checked" if all of the "A", "B", and "C" check boxes are selected in the "checking" field .
Formula:
IF(OR(CONTAINS(checking, "A"),CONTAINS(checking, "B"),CONTAINS(checking, "C")),"","unchecked")


It displays "unchecked" if any of the "A", "B", or "C" check boxes is not selected in the "checking" field.