Comparison Operator in Excel

Comparison operator in Excel are used to compare values if the values are equal, if the value is Greater than or equal to Excel, if the value is less than another value, etc.

Equal To

In Microsoft Excel, the “EQUAL TO” comparison is usually done with the equal sign (=). This operator compares two values to see if they are equal. Here is a simple example.

Assume you have two cells, A2 and B2, and wish to confirm whether the values in these cells are equal. In another cell such as C2, you can use the formula below:


=IF(A2=B2, “Equal”, “Not Equal”)

The formula applies the IF function by comparing values in cells A2 and B2. It outputs “Equal” if they are equal and “Not Equal” otherwise. You customize this formula for your needs.

Here is a step-by-step breakdown of the formula:

IF(: The IF function begins, it has three parameters to evaluate.

A2=B2, “Equal”, “Not Equal”: The first parameter is the test that checks if A2 equals B2. If true, the function returns the word Equal; otherwise, it returns Not Equal.

): Closes the IF function.

Output:

Comparison Operator in Excel
-

Greater Than in Excel

The greater than operator (>) can be used to compare if one value is greater than another. For example:

Suppose you have a table with two columns, A and B, and you wish to know whether the value in column A is greater than the value in column B. In column C, use the formula below:

=IF(A2>B2, “A is greater”, “A is not greater”)

This formula uses the IF function to compare the values in cells A2 and B2. If the value in A2 is greater than that in B2, it returns “A is greater”; otherwise, it returns “A is not greater”.

Output:

-

Less Than in Excel:

If one value is smaller than another, you can use the operator less than (<) to compare them. As a sample:

let’s suppose you own two columns, A and B in a table and need to ascertain if the value inside column A is smaller than that in B. The subsequent expression can be applied to column C:

=IF(A1<B1, “A is less”, “A is not less”)

This formula uses the IF function to compare the values in cells A2 and B2. If the value in A2 is less than that in B2, it returns “A is less”; otherwise, it returns “A is not less”.

-

Greater than or equal to Excel

Another way to check if one value is greater than or equal to another is by using the >= operator. For instance:

Assuming you have a table with two columns A and B and you want to verify if the value in column A is greater or equal to the value in column B. Let’s say you can use the formula below for column C:

=IF(A2>=B2, “A is greater than or equal”, “A is less than”)

This formula uses the IF function to compare the values in cells A2 and B2. If the value in A2 is Greater than or equal to Excel in B2, it returns “A is less”; otherwise, it returns “A is not less”.

Output:

-


Similarly, this method is used for the less than or equal to Excel operator.

Not Equal to in Excel

A simple way to examine the inequality of values is by using the less than operator (<>) which checks if one value is not equal to another. An example can be given as shown below:

For instance, assume you have a table with two columns A and B and you would like to check if the value in column A is not equal to the value in column B. In column C, you can use this formula:

=IF(A2<>B2, “A is not equal to”, “A is equal to”)

This formula compares the values in cells A1 and B1 using an IF function. If the value in A2 is not equal to that in B2, it returns “A is not equal to” and if not it returns “A is equal to”.

Output:

-