Microsoft Excel – Logical Functions – AND, OR and XOR formulas

I have explained a few logical functions in the Article “Microsoft Excel – Logical Functions – IF, IFERROR and IFNA formulas“. In this article, we will go through another set of logical functions AND, OR, and XOR. All of these formulas take multiple arguments; the first argument is mandatory and the other arguments are optional.

All of these formulas will return a logical value either TRUE or FALSE unless there is no Error.

AND function

The syntax of AND formula is:

=AND(argument 1, [argument 2], ...)

Where arguments are logical values or numeric values or the logical expressions or even references to the Cells. The first argument is a must and the rest are optional.

AND formula checks whether all of its arguments are TRUE; then returns the logical value TRUE. Otherwise, this function returns the logical value FALSE.

FormulaResult
=AND(TRUE, TRUE)TRUE
=AND(TRUE, FALSE)FALSE
=AND(FALSE, FALSE)FALSE

OR function

OR function verifies whether one of its arguments is TRUE and returns the logical value TRUE. Else, this formula returns the logical value FALSE.

The Syntax of the OR function is:

=OR(argument 1, [argument 2], ...)

Unlike AND formula OR formula returns the logical value TRUE if any of its arguments is TRUE or all arguments are TRUE.

FormulaResult
=OR(TRUE, TRUE)TRUE
=OR(TRUE, FALSE)TRUE
=OR(FALSE, FALSE)FALSE

XOR function

XOR function returns the logical “Exclusive OR” of all of its arguments. This is a bit tricky to understand. To simplify, if you pass two arguments to XOR formula; it returns the value TRUE, ONLY when one of its arguments is TRUE and the other argument is FALSE.

The Syntax of the XOR function is:

=XOR(argument 1, [argument 2], ...)

When we pass multiple arguments to this function, how do we know which logical value this function returns? Let’s take an example:

=XOR(TRUE, FALSE, TRUE)

The above formula returns the value, FALSE. Because, XOR of the first two arguments returns the value TRUE; then XOR of TRUE, TRUE returns the value FALSE.

To easy to remember, XOR returns the logical value TRUE; if its arguments contain an odd number of TRUE inputs. Otherwise, this function returns the value FALSE.

FormulaResult
=XOR(TRUE, TRUE)FALSE
=XOR(TRUE, FALSE)TRUE
=XOR(FALSE, FALSE)FALSE

All of these functions are NOT allowed to pass text as an argument. If you pass text, these functions return “#VALUE!” Error.

We discuss more on Excel through upcoming Articles.

🙂 Sahida

Microsoft Excel – Logical Functions – AND, OR and XOR formulas

Leave a Reply

Your email address will not be published.

Scroll to top