Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Greater Than Operator
3.
Less Than Operator
4.
Greater Than or Equal to Operator
5.
Less Than or Equal to Operator
6.
Equal to Operator
7.
Not Equal to Operator
8.
FAQs
9.
Key Takeaways
Last Updated: Mar 27, 2024
Easy

Comparison Operators in Excel

Author dhruv sharma
2 upvotes
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

The comparison operators are one of the most frequently used operations on columns performed in Excel while making calculations or intermediate result generations for analysing data. The article covers basic comparison operators (majorly logical operators) such as equal to, greater than, less than etc. and how these could be used while making various kinds of computations. 

Greater Than Operator

The "Greater Than" logical operator is used to compare values/columns to check which of the compared value is greater, i.e. whether one of the compared values is greater than the other.

The above comparison returns true as the value in cell B1 is greater than that in A1.

Most of the time, one will use the greater than operator to compare a range of cells in Excel.

Here the greater than comparison operator is applied on both columns A and B values, and the resultant is stored in column C after the comparison.

NOTE: The SUM formula immediately adjusts when a value is added or removed. Changes to an existing cell range are also included. In addition, the function ignores empty cells and text values.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Less Than Operator

The "Less Than" logical operator is used to compare values/columns to check which of the compared value is smaller, i.e. whether one of the compared values is smaller than the other.

The above comparison returns false as the value in cell B1 is not less than that in A1.

One will use the less-than operator to compare a range of cells in Excel most of the time.

Here, the less-than comparison operator has applied on columns A and B, and the resultant is stored in column C after the comparison.

Greater Than or Equal to Operator

The “Greater Than or Equal to” logical operator is used for comparing values/columns to check which of the compared value is greater than or equal to the other, i.e. whether one of the compared values is greater than or equal to the other value or not.

The above comparison returns true as the value in cell B1 is greater than that in A1.

One can also use the operator and more aggregating functions/operators such as 'SUMIF' etc.

Here the SUMIF function is being applied along with the greater than or equal to comparison operator on column A on all the greater than or equal to 55, i.e. 65 + 79 + 60 = 204.

Less Than or Equal to Operator

The “Less Than or Equal to” logical operator is used for comparing values/columns to check which of the compared value is less than or equal to the other, i.e. whether one of the compared values is less than or equal to the other value or not.

The above comparison returns true as the value in cell B1 satisfies the comparison condition less than or equal to the value in A1.

One can also use the operator and more aggregating functions/operators such as 'COUNTIF' etc.

Here the COUNTIF function is being applied along with the less than or equal comparison operator on column A on all the values that are less than or equal to 50, i.e. 7, 48 and 10, therefore, total 3.

Equal to Operator

The "Equal to" logical operator is used to compare values/columns to check if the compared values are equal, i.e. whether the compared values are equal.

One can also use the equal to the operator and the IF function.
 

Here, the equal to comparison operator aggregated with the IF function is applied on both columns A and B values. The resultant is stored in column C after the comparison.

Not Equal to Operator

The "Not Equal to" logical operator is used to compare values/columns to check if the compared values are not equal, i.e. whether the compared values are equal

One can also use the "not equal to" operator and the IF function.

Here, the "not equal to" comparison operator aggregated with the IF function is applied on columns A and B, and the resultant is stored in column C after the comparison.

FAQs

1. Would the logical "equal to" comparison operator only work on numbers or other types of values such as strings or dates?

In Excel, one can also use the "equal to" logical comparison operator to compare any other type of values, such as the boolean values(TRUE, FALSE), strings, dates, etc.

2. Which other type of functions would the comparison operators be combined with?

Different types of other excel functions such as OR, AND, EXACT, SUM etc., can also be combined on top of the comparison operators that we learned about in the article.

Key Takeaways

In this article, we learned about the major logical comparison operators used in Excel. We also covered how one could use them with aggregating functions on a range of cell values such as COUNTIF, SUMIF etc.

EXPLORE MORE!

You can use Coding Ninjas Studio to practice various DSA questions asked in different interviews. It will help you master effective coding techniques, and you will also get interview experiences from people working in big companies.

Previous article
Using the If Conditional in Excel VBA
Next article
AND & OR Function in Excel
Live masterclass