XOR

Evaluates multiple conditions and returns TRUE only if exactly one or an odd number of conditions are met.

The XOR (Exclusive OR) function returns TRUE if exactly one or an odd number of the specified conditions is TRUE. Otherwise, it returns FALSE. It is commonly used with IF and other logical functions to evaluate mutually exclusive conditions.

Syntax

XOR(logical_test1,[logical_test2], ...)

Arguments

  • logical_test1: The first condition to evaluate.

  • logical_test2, ... (Optional): Additional conditions to evaluate.

Return value

Returns TRUE if an odd number of conditions are TRUE; otherwise, returns FALSE.

Example

IF(XOR(Sub Region == "APAC", Sub Category == "Juices"), 52640000, 0)

In this example, the XOR function is used within an IF statement to assign values to the 2027 Actuals Plan. The function evaluates whether only one of the conditions is TRUE: Sub Region is APAC or Sub Category is Juices. If exactly one condition is TRUE, the formula returns 52.64 million; otherwise, it returns 0.

Excel equivalent

XORarrow-up-right

Last updated

Was this helpful?