Skip to content

=ENCLOSE

Functions separate their parameters with semicolons (;). When text you type into a formula contains a semicolon of its own, the function reads each piece as a separate parameter. The ENCLOSE function keeps that text together as one value.

=ENCLOSE(ValueToKeepTogether)
  • ValueToKeepTogether

    • The text to treat as one value, semicolons included.

Most functions give each parameter its own job. In =REPLACE, the first parameter is the text to find, the second is its replacement, and the third is the text to search. These functions read an enclosed value as one parameter.

=REPLACE(Mon; Monday; =ENCLOSE(Mon; Wed; Fri))
  • Returns Monday; Wed; Fri. Without ENCLOSE, =REPLACE would receive five parameters and return a blank.

Other functions with set parameters, such as =IF and =LEFTOF, work the same way.

=EQUALS and =!EQUALS keep each value whole too. So two copies of the same JSON text, which may contain semicolons, are compared as whole values:

=EQUALS(=ENCLOSE({"note":"Call first; then email"}); =ENCLOSE({"note":"Call first; then email"}))
  • Returns 1.

=CONTAINS and =!CONTAINS keep each value whole as well. So text to look for that contains a semicolon is looked for as a whole:

=CONTAINS(=ENCLOSE(first; then); [[Field: Notes (Text)]])
  • Returns 1 when the Notes field holds Call first; then email, and 0 when it holds Call first then email.

A field token’s value and the result of another function are kept together like this without ENCLOSE. So you need ENCLOSE only for text you type into the formula yourself. Wrapping a field token in ENCLOSE does no harm.

Some functions treat all of their parameters as one list of values. These functions remove ENCLOSE and split the value at every semicolon. The same happens to a field token’s value and to another function’s result.

  • Lists: =LISTASLINES, =LISTCOUNT, =LISTDIFF, =LISTINDEX, =LISTINTERSECT, =LISTJOIN, =LISTMERGE, =LISTUNIQUE

  • List items: =LISTITEMAPPEND, =LISTITEMCONTAINS, =LISTITEMENDSWITH, =LISTITEMLEFT, =LISTITEMLEFTOF, =LISTITEMPREPEND, =LISTITEMREGEX, =LISTITEMRIGHT, =LISTITEMRIGHTOF, =LISTITEMSTARTSWITH

  • Numbers: =MAX, =MIN, =SUM

  • True or false: =ANYTRUE, =ISTRUE

  • Other: =FIRSTVALUE

For most of these, splitting is what you want, because the value is the list. If a Colors field holds Red; Blue; Green:

=LISTCOUNT([[Field: Colors (Text)]])
  • Returns 3, with or without ENCLOSE.

Splitting gets in the way when you mean one value. If a Notes field holds Call first; then email:

=FIRSTVALUE([[Field: Notes (Text)]]; No notes)
  • Returns Call first, even when the field token is wrapped in ENCLOSE.

To return the whole note, use =IF, which keeps the value together:

=IF(=HASVALUE([[Field: Notes (Text)]]); [[Field: Notes (Text)]]; No notes)
  • Returns Call first; then email, or No notes when the field is empty.
  • Formula functions are case sensitive and must be written in ALL CAPS.

ENCLOSE, keep text together, semicolon in a value, semicolon handling, protect value, list functions, split list, field token, workflow formulas, formula function