Is a comparison operator in Excel

Excel comparison operators can compare two values and return a logical (Boolean) value. You can use the return logical value in other functions like IF, or features, like Conditional Formatting, that require a logical value input. In this guide, we are going to show you various types of Excel comparison operators available, and go over some tips and examples. Let's start with a few tips:

  • A logical comparison always returns a Boolean value. Per its definition, this means that there are two possible outcomes (Boolean): TRUE and FALSE.
  • The comparisons are formulas. You do not need any other functions to execute them. Simply begin with an equal operator (=) like starting a regular formula:
  • You can use these operators everywhere a logical test is allowed. For example, you can use these operators in IF, AND, OR and NOT functions:
  • We recommend using the EXACT function to compare strings.

Equal to

The equal to operator (=) returns TRUE if two values are equal to each other, otherwise FALSE.

Is a comparison operator in Excel
Is a comparison operator in Excel

Greater than

The greater than operator (>) returns TRUE if the first value is greater than the second value, and returns FALSE otherwise.

Is a comparison operator in Excel

Less than

The less than operator (<) returns TRUE if the first value is less than the second value, and returns FALSE otherwise.

Is a comparison operator in Excel

Greater than or equal to

The greater than or equal to operator (>=) returns TRUE if the first value is greater than or equal to the second value, and returns FALSE otherwise.

Is a comparison operator in Excel

Less than or equal to

The less than or equal to operator (<=) returns TRUE if the first value is less than or equal to the second value, and returns FALSE otherwise.

Is a comparison operator in Excel

Not Equal to

The not equal to operator (<>) returns TRUE if two values are not equal to each other, and returns FALSE otherwise.

Is a comparison operator in Excel

Alternatively, you can use the NOT function with the equal to operator to essentially run the same test.

Is a comparison operator in Excel

Build Professional - Unbreakable - Forms in Excel

45 Tutorials - 5+ Hours - Downloadable Excel Files

Instant Access! - Lifetime Access!

Add to Favorites Favorited

Is a comparison operator in Excel

(Video tutorial's page: Compare Values in Excel - Beginner to Advanced)

Logical comparison operators allow you to compare values in Excel to see if they are equal, not equal, greater than, or less than.  The result of one of these comparisons will either be TRUE or FALSE.  These operators allow you to make powerful spreadsheets in Excel and, here, I will tell you how to use these operators.

List of Logical Comparison Operators

Condition Operator Description Simple Usage Example

Equal to

=

Checks if a value is equal to another value.

=1=5

(checks if 1 is equal to 5 - result will be FALSE)

Not equal to <>

Check if a value is NOT equal to another value.

=1<>5

(checks if 1 is NOT equal to 5 - result will be TRUE)

Greater than

>

Check if a value is greater than another value.

=1>5

(checks if 1 is greater than 5 - result will be FALSE)

Less than

<

Check if a value is less than another value.

=1<5

(checks if 1 is less than 5 - result will be TRUE)

Greater than or equal to

>=

Check if a value is greater than OR equal to another value.

=1>=5

(checks if 1 is greater than or equal to 5 - result will be FALSE)

Less than or equal to

<=

Check if a value is less than OR equal to another value.

=1<=5

(checks if 1 is less than or equal to 5 - result will be TRUE)

How to Use Logical Operators

You use logical operators within formulas and functions in order to make comparisons.

Here is a list of the most basic formulas using logical operators and their results (examples are from the table above):

Is a comparison operator in Excel

Here, we are simply comparing 1 to 5.

As you can see, the output of any comparison made with logical operators will always be either TRUE or FALSE.  That output is often useless on its own but functions can use that output to perform complex operations in Excel.

Logical Operators within Functions

The function where you will most often use logical operators is the IF statement.  This statement helps you make decisions in Excel and directly adds logic to the spreadsheet.

To use a logical operator in a function, you simply type the comparison anywhere in the function where it is required.

Here, we will compare the values from cell D1 and E1 and output a result based on that comparison:

Is a comparison operator in Excel

The formula is in cell D5 but is listed in cell D3.  Looking to cell D3, you can see that we used the logical operator greater than within the IF statement.  Using this logical operator, greater than, any time the value in cell D1 is greater than the value in cell E1, the IF statement will output "End of the World".

As far as logical operators in functions and formulas goes, that's all there is to it.  You simply use the desired comparison operators to type a comparison anywhere you need something to evaluate to either TRUE or FALSE.

As you can see, logical operators help you made decisions within Excel and, though this is a basic example, you can see just how important this functionality is in the spreadsheet.  This is what allows you to create powerful spreadsheets, and it all starts with these simple logical operators.

Note: When you use logical operators to make comparisons within a function you do not need to put an equal sign in front of the logical comparison. The equal sign in front of the logical comparisons made at the top of this tutorial where there just because you need an equals sign to start a formula or function in any cell, but the following formulas/functions/logical comparisons within the same cell do not need their own equals sign to start it.

The below links will show you more complex ways that you can use logical operators to make comparisons in Excel.

How to Use the IF Function in Excel

AND Function - Check if All Arguments are True

OR Function - Check if Any Argument is True

Notes

Logical operators are a small piece of the puzzle that is Excel but they will help you to make immensely more useful and powerful spreadsheets.  Learn the comparison operators, and just keep them in the back of your mind for when you might need to use them.

Make sure to download the accompanying spreadsheet to see all of the logical operators at work in Excel.

Is a comparison operator in Excel

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

()

Similar Content on TeachExcel

The link to our top 15 tutorials has been sent to you, check your email to download it!

(If you don't see the email, check your Spam or Promotions folder and make sure to add us as a contact so you get our emails in the future.)