AND (&&)

Description

The AND (`&&`) operator determines whether two conditions are both true.

Multiple AND call can be chained together to test whether a set of more than two conditions are true.

Usage

``````a && b
a && b && c
``````
Argument Required Expected Type Description
a Yes Boolean The first condition
b Yes Boolean The second condition

Result

• TRUE if both conditions evaluate to TRUE.
• FALSE if one or both conditions evaluate to FALSE.
• BLANK if either condition is BLANK.

Examples

If you have a multiple-select field with the code `VAC` and the options:

• Cholera
• Rubella
• Typhoid
• Measles
• Mumps

Then you could write the following formula to count the number of children who have received both the measles and the mumps vaccines:

``````VAC.Measles && VAC.Mumps
``````

Which gives the following results:

VAC Result
Cholera, Rubella, Typhoid FALSE
Cholera, Measles FALSE
FALSE
Measles, Rubella, Typhoid, Mumps TRUE

You could also use the IF function to turn the boolean value ("TRUE" or "FALSE") into a number:

``````IF(VAC.Measles && VAC.Mumps, 1, 0)
``````
VAC Result
Cholera, Rubella, Typhoid 0
Cholera, Measles 0
0
Measles, Rubella, Typhoid, Mumps 1

Finally, you can repeat the `&&` operator to check that more than two conditions are true. The following formula for example counts the children who have received Measles, Mumps, and Rubella:

``````IF(VAC.Measles && VAC.Mumps && VAC.Rubella,1,0)
``````
VAC Result
Cholera, Rubella, Typhoid 0
Cholera, Measles 0
0
Measles, Rubella, Typhoid, Mumps 1
Rubella 0
Measles, Mumps 1