Purpose

Return value

Syntax

=TRUE()

Using the TRUE function

The TRUE function returns the Boolean value TRUE. In other words, the two formulas below based on the IF function are functionally equivalent:

=IF(A1>65,TRUE())
=IF(A1>65,TRUE)

Both formulas return TRUE if the value in A1 is greater than 65.

The TRUE function is provided for compatibility with other spreadsheet applications and there is no need to use it if you are creating a spreadsheet in Excel. To return TRUE as a result in a formula, just enter TRUE directly into a cell or formula.

Note that logical expressions will automatically generate TRUE and FALSE results. For example, the formula below will TRUE or FALSE:

=A1>90

To test a condition and return different results based on whether the results are TRUE or FALSE, see the examples on this page .

Purpose

Return value

Syntax

=XOR(logical1,[logical2],...)
  • logical1 - An expression, constant, or reference that evaluates to TRUE or FALSE.
  • logical2 - [optional] An expression, constant, or reference that evaluates to TRUE or FALSE.

Using the XOR function

The XOR function performs what is called “exclusive OR”, in contrast to the “inclusive OR” performed by the OR function . Whereas the OR function returns true if any input is TRUE, XOR only returns TRUE in specific cases. In the simplest case, with just two logical statements, XOR returns TRUE only if one of the logicals is TRUE. If both values are TRUE, XOR returns FALSE.

The concept of exclusive OR is more common in the world of programming. In plain English, you can think of a sentence like this: “I’m either going to visit New York or San Francisco this summer”. Nothing prevents the speaker from visiting both, but the meaning is clearly that they plan to visit only one or the other. If they visit one or the other, the original statement is TRUE. If they visit neither or both, the original statement is FALSE.

Example #1 - two values

In the example shown, the formula in D5, copied down, is:

=XOR(B5,C5)

At each row, XOR only returns TRUE when B5 and C5 contain a single TRUE or equivalent value.

Example #2 - more than two values

With more than 2 values, the behavior of XOR is a bit different. With three or more logicals, XOR only returns TRUE when the number of TRUE values is odd, as shown in the following example:

XOR with more than two logicals - 1

In this example, XOR is given a range with five values in a single argument instead of five separate arguments. The formula in G6 copied down is:

=XOR(B6:F6)

The result is TRUE only when the number of TRUE values columns B through F is an odd number.

Notes

  • Logical arguments must evaluate to TRUE or FALSE, 1 or 0, or be references that contain logical values.
  • XOR returns #VALUE! if no logical values are found.
  • With more than two logicals, XOR returns TRUE when the number of TRUE logicals is odd, and FALSE if not.
  • XOR was introduced in Excel 2013.