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"), "Working on Sunday", "Not Working on Sunday")


It displays "Working on Sunday" if Sunday is selected in the "Workday" field. Otherwise, "Not Working on Sunday" is displayed.
Formula:
8000+IF(CONTAINS(Lodging_Option, "Breakfast Included"), 1500, 0)


It displays the sum of the lodging cost 8,000 yen and breakfast 1,500 yen if "Breakfast Included" is selected in the "Lodging Option" 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(Check, "A"),CONTAINS(Check, "B"),CONTAINS(Check, "C")),"Completed","")


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


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