Equality operator (=)

Value1 = Value2

Value1

? or { ? }

The first value to compare.

Value2

? or { ? }

The second value to compare.

Returns

Logical or { Logical }

Whether the first value is equal to the second value.

Returns whether the first value is equal to the second value. 2 = 32 = 3 returns FALSE, but 2 = 22 = 2 and "a" = "A""a" = "A" return TRUE. Text string comparisons are case-insensitive.

This operator also works with arrays. { 5, 7 } = 7{ 5; 7 } = 7 returns the array { FALSE, TRUE }{ FALSE; TRUE } (equivalent to { 5 = 7, 7 = 7 }{ 5 = 7; 7 = 7 }) and { 5, 7 } = { 5, 10 }{ 5; 7 } = { 5; 10 } returns the array { TRUE, FALSE }{ TRUE; FALSE } (equivalent to { 5 = 5, 7 = 10 }{ 5 = 5; 7 = 10 }).

Related operators and functions

The == operator is similar to this operator, but is case-sensitive and returns a single logical value when applied to arrays (see below for an example).

The EXACT function may be used to compare to text strings in a case-sensitive manner, like the == operator.

The first formula below returns TRUE and the remaining two formulas return FALSE:

"Test" = "test""Test" = "test"
"Test" == "test""Test" == "test"
EXACT("Test", "test")EXACT("Test"; "test")

FILTER, arrays and =

The logical arrays returned by this operator are especially useful with functions like FILTER, which takes an array and returns another array only containing certain elements.

This formula returns the array { 2 }{ 2 }:

FILTER({ 2, 4 }, { 2, 4 } = 2)FILTER({ 2; 4 }; { 2; 4 } = 2)

4 is left out, because it is not equal to 2.

The formula above works because { 2, 4 } = 2{ 2; 4 } = 2 is expanded to the array { TRUE, FALSE }{ TRUE; FALSE } by the = operator. As such, the formula above is equivalent to this formula:

FILTER({ 2, 4 }, { TRUE, FALSE })FILTER({ 2; 4 }; { TRUE; FALSE })

Determining if two arrays are identical

To determine if two arrays are identical to one another, = can be used together with the AND function. This formula returns TRUE:

AND({ 2, 2 } = { 2, 2 })AND({ 2; 2 } = { 2; 2 })

The formula above works because { 2, 2 } = { 2, 2 }{ 2; 2 } = { 2; 2 } is expanded to the array { TRUE, TRUE }{ TRUE; TRUE } by the = operator. As such, the formula above is equivalent to this formula:

AND({ TRUE, TRUE })AND({ TRUE; TRUE })

The == operator can also be used to determine if two arrays are identical. This formula returns TRUE:

{ 2, 2 } == { 2, 2 }{ 2; 2 } == { 2; 2 }

Examples

2 = 32 = 3

Returns FALSE.

2 = 22 = 2

Returns TRUE.

"a" = "A""a" = "A"

Returns TRUE. Text string comparisons are case-insensitive.

EXACT("a", "A")EXACT("a"; "A")

Returns FALSE, as EXACT compares text strings in a case-sensitive manner.

"a" == "A""a" == "A"

Returns FALSE, as the == operator compares text strings in a case-sensitive manner.

{ 5, 7 } = 7{ 5; 7 } = 7

Returns the array { FALSE, TRUE }{ FALSE; TRUE }, equivalent to { 5 = 7, 7 = 7 }{ 5 = 7; 7 = 7 }.

{ 5, 7 } = { 5, 10 }{ 5; 7 } = { 5; 10 }

Returns the array { TRUE, FALSE }{ TRUE; FALSE }, equivalent to { 5 = 5, 7 = 10 }{ 5 = 5; 7 = 10 }.

FILTER({ 2, 4 }, { 2, 4 } = 2)FILTER({ 2; 4 }; { 2; 4 } = 2)

Returns the array { 2 }{ 2 }. 4 is left out, because it is not equal to 2.