Home › data analytics Tutorial › IF, AND, and OR Functions in Excel

IF, AND, and OR Functions in Excel

⏱ 8 min read Updated: 29 Sep 2026

IF, AND, and OR Functions in Excel

IF, AND, and OR are logical functions used to check conditions and return results based on those conditions. The IF function returns different results depending on whether a condition is true or false. The AND function returns true only when all given conditions are true, while the OR function returns true when at least one condition is true.

In this article, we will learn about the IF, AND, and OR functions in Excel, their syntax, arguments, examples, and how we can combine them to work with data.

What Are Logical Functions in Excel?

Logical functions are used to check conditions and return results based on whether those conditions are true or false. They are useful for working with student marks and results, employee records, sales data, business reports, attendance records, eligibility criteria, data analysis, and large datasets. The IF, AND, and OR functions are the most useful logical functions for working with conditions in Excel.

IF Function in Excel

The IF function checks whether a condition is true or false. It returns one value when the condition is TRUE and another value when the condition is false.

IF Function Syntax

It has the following syntax.

=IF(logical_test, value_if_true, value_if_false)

IF Function Arguments

The IF function has three main arguments:

  • logical_test: It is the condition that the function checks.
  • value_if_true: It is the value returned when the condition is TRUE.
  • value_if_false: It is the value returned when the condition is FALSE.

Example of IF Function

Suppose cell A2 contains a student's marks. We want to check whether the student has passed or failed.

=IF(A2>=40,"Pass","Fail")

If A2 contains 65, the result will be:

Pass

If A2 contains 32, the result will be:

Fail

Here, the function checks whether the marks are greater than or equal to 40. If the condition is TRUE, it returns Pass. Otherwise, it returns Fail.

Important Points

  • The IF function checks a condition.
  • It can return different results based on a condition.
  • It can be used with numbers, text, and other formulas.
  • Multiple IF functions can be combined when more conditions are required.
  • It is useful for creating condition-based results.

AND Function

The AND function is used when we need to check multiple conditions at the same time. It returns true only when all the given conditions are true. If even one condition is false, the AND function returns false.

AND Function Syntax

It has the following syntax.

=AND(logical1, [logical2], ...)

AND Function Arguments

  • logical1: It is the first condition that the function checks.
  • logical2: It is an optional additional condition.
  • Additional conditions can also be included when required.

Example of AND Function

Suppose A2 contains marks in one subject and B2 contains marks in another subject. We want to check whether the student scored at least 40 marks in both subjects.

=AND(A2>=40,B2>=40)

If A2 contains 55 and B2 contains 65, the result is TRUE because both values are 40 or more. If A2 contains 55 and B2 contains 30, the result is FALSE because both conditions must be TRUE. 

Important Points

  • The AND function is used to check the multiple conditions.
  • It returns TRUE when all conditions are TRUE.
  • It returns FALSE when any condition is FALSE.
  • It is useful when all requirements must be satisfied.
  • AND can be used with the IF function to check multiple conditions and return a specific result.

OR Function

The OR function is used when we need to check multiple conditions and only one condition needs to be true. It returns true when at least one condition is true. It returns false only when all conditions are false.

Syntax

It has the following syntax.

=OR(logical1, [logical2], ...)

OR Function Arguments

  • logical1: It is the first condition that the function checks.
  • logical2: It is an optional additional condition.
  • Additional conditions can be included when required.

Example

Suppose A2 contains the marks of a student in one subject and B2 contains the marks in another subject. We want to check whether the student scored at least 80 marks in either subject. We can use the following formula:

=OR(A2>=80,B2>=80)

If A2 contains 85 and B2 contains 60, the formula returns TRUE because the first condition, A2>=80, is satisfied. The OR function returns TRUE when at least one of its conditions is true. If A2 contains 70 and B2 contains 60, the formula returns false because neither value is 80 or more. In this case, both conditions are false, so the OR function returns false.

Important Points About the OR Function

  • The OR function checks multiple conditions.
  • It returns true when at least one condition is true.
  • It returns false when all conditions are false.
  • It is useful when any one of several requirements can be satisfied.
  • OR can be used with the IF function to check multiple conditions and return a specific result.

IF with AND Function

We can combine the IF and AND functions when we need to check multiple conditions and all of them must be true to return a specific result. For example suppose an employee is eligible for a bonus when their sales are at least 50,000 and they have completed at least 8 years of service.

The formula can be written as:

=IF(AND(A2>=50000,B2>=8),"Bonus","No Bonus")

Here:

  • AND(A2>=50000,B2>=8) checks both conditions.
  • If both conditions are TRUE, IF returns Bonus.
  • If any condition is FALSE, IF returns No Bonus.

This combination is useful when we need to check multiple requirements before returning a result.

IF with OR Function

We can combine the IF and OR functions when a result should be returned if at least one condition is true. For example, suppose an employee is eligible if their sales are at least 50,000 or they have completed at least 8 years of service.

The formula can be written as:

=IF(OR(A2>=50000,B2>=8),"Eligible","Not Eligible")

Here:

  • OR(A2>=50000,B2>=8) checks both conditions.
  • If at least one condition is TRUE, IF returns Eligible.
  • If both conditions are FALSE, IF returns Not Eligible.

Difference Between IF, AND, and OR

FunctionPurposeResult
IFChecks a condition and returns different valuesDepends on the condition
ANDChecks multiple conditionsTRUE if all conditions are TRUE
ORChecks multiple conditionsTRUE if at least one condition is TRUE

The main difference is that IF is used to return different results, while AND and OR are mainly used to evaluate multiple conditions.

Common Uses of IF, AND, and OR Functions

We can use these functions in many different types of worksheets.

Some common uses include:

  • Checking whether students have passed or failed
  • Checking employee eligibility
  • Calculating bonuses
  • Checking sales targets
  • Evaluating attendance
  • Checking product conditions
  • Creating business reports
  • Validating data
  • Analyzing large datasets
  • Creating automated worksheets

Advantages of Using IF, AND, and OR Functions

These logical functions provide several benefits when working with data.

Some of the main advantages are:

  • They help check conditions quickly.
  • They reduce manual decision-making in worksheets.
  • They help create condition-based results.
  • They can be combined to handle multiple conditions.
  • They are useful for data analysis and reporting.
  • They help automate repetitive tasks.
  • They make large datasets easier to work with.
  • They can be used to create dynamic worksheets.

Frequently Asked Questions

What is the IF function in Excel?

The IF function checks a condition and returns one value when the condition is TRUE and another value when the condition is FALSE.

What is the AND function in Excel?

The AND function checks multiple conditions and returns TRUE only when all conditions are TRUE.

What is the OR function in Excel?

The OR function checks multiple conditions and returns TRUE when at least one condition is TRUE.

What is the difference between AND and OR?

AND returns TRUE only when all conditions are TRUE, while OR returns TRUE when at least one condition is TRUE.

Can we use IF with AND?

Yes, we can combine IF with AND when multiple conditions must be satisfied before returning a result.

Can we use IF with OR?

Yes, we can combine IF with OR when at least one of multiple conditions should be satisfied.

Which function is used to check multiple conditions?

The AND and OR functions are used to check multiple conditions. They can also be combined with IF to return a specific result based on those conditions.

Conclusion

The IF, AND, and OR functions in Excel are useful for checking conditions and working with logical data. The IF function helps return different results based on a condition, while AND checks whether all conditions are TRUE and OR checks whether at least one condition is TRUE. We can also combine IF with AND or OR to create formulas for more complex conditions. These functions are useful for Excel data analysis, reports, spreadsheets, and large datasets.