How to Use IF, AND, OR in Excel Formulas

IF AND OR are the three formulas every Excel user eventually meets. IF handles simple decisions. AND and OR handle multiple conditions. Together, they let you build logic into a spreadsheet that responds to real data.

The problem is that most people learn them separately and then struggle to combine them. In this article, I will explain each one clearly, then show you how to use them together without making your formulas unreadable.

IF, AND, OR in Excel

What Does IF Do?

IF checks a condition and returns one value if the condition is true, and another value if it is false. The syntax is:

=IF(logical_test, value_if_true, [value_if_false])

Example:

=IF(B2>=50000, "Target Met", "Below Target")

If the value in B2 is 50,000 or more, the cell shows “Target Met”. Otherwise it shows “Below Target”. Simple.

IF can return numbers too:

=IF(B2>=50000, B2*0.05, 0)

This returns a 5% bonus if the target is met, and zero otherwise. IF returns text, numbers, dates, or even other formulas.

Nested IFs

You can nest IFs inside IFs to handle more cases. For example:

=IF(B2>=80000, "Excellent", IF(B2>=60000, "Good", IF(B2>=40000, "Average", "Below Target")))

This works but becomes hard to read after three levels. As a rule, if you need more than three nested IFs, look for a cleaner option like IFS or a lookup table. Nested IFs are still common in older files, but they are not the best tool for new work.

What Does AND Do?

AND checks two or more conditions and returns TRUE only if all of them are true. The syntax is:

=AND(condition1, condition2, ...)

Example:

=AND(B2>=50000, C2>=80)

This returns TRUE only if B2 is 50,000 or more AND C2 is 80 or more. If either one fails, AND returns FALSE.

AND is usually not used on its own. It is combined with IF.

What Does OR Do?

OR checks two or more conditions and returns TRUE if at least one of them is true. The syntax is:

=OR(condition1, condition2, ...)

Example:

=OR(B2>=50000, C2>=80)

This returns TRUE if B2 meets the target OR C2 meets it. Only one needs to be true.

Combining IF with AND

This is the most useful pattern. You want to test two conditions before returning a result.

Example: An employee gets a bonus if sales are above 50,000 AND attendance is above 90%.

=IF(AND(B2>=50000, C2>=90), "Bonus", "No Bonus")

Only employees who meet both conditions get the bonus. If either one fails, the answer is “No Bonus”.

This is cleaner than nesting IFs. It reads like a sentence: “If B2 is at least 50,000 and C2 is at least 90, give bonus.”

Combining IF with OR

Sometimes meeting any one condition is enough. Example: A file is flagged if it is more than 30 days old OR has a status of “Missing”.

=IF(OR(A2>TODAY()-30, C2="Missing"), "Flag", "OK")

Either condition triggers the flag. This is common in reporting sheets and compliance checks.

Combining IF with AND and OR

You can use both at once when the logic calls for it. Example: An order qualifies for free shipping if the total is over 5,000 AND either the customer is a premium member OR the order is over 20,000.

=IF(AND(B2>=5000, OR(C2="Premium", B2>=20000)), "Free Shipping", "Paid Shipping")

Read it in plain English: total must be at least 5,000 AND one of the two extra conditions must be true.

When formulas get long, break them into separate cells. For example, put the AND/OR result in one cell and the IF result in another. This is easier to debug and easier to read later.

Real Example: Employee Status

Columns: A Name, B Sales, C Attendance, D Status

Rule: An employee is “On Track” if sales are at least 60,000 AND attendance is at least 85%. Otherwise “Review”.

=IF(AND(B2>=60000, C2>=85), "On Track", "Review")

Copy down. Done. One clean formula, one clear rule.

Real Example: Discount Rules

Columns: A Order ID, B Total, C Customer Type

Rule: Give a 10% discount if total is over 5,000 and customer type is “Regular”. Give 15% if customer type is “VIP”. No discount otherwise.

=IF(C2="VIP", B2*0.15, IF(AND(B2>=5000, C2="Regular"), B2*0.10, 0))

This nested IF with AND handles all three cases. The order matters. VIP is checked first, because VIP customers get the best discount regardless of total.

Why the Formula Returns an Error

  1. Forgetting quotes around text. Use “On Track”, not On Track.
  2. Using AND when you mean OR. This is the most common mistake. Read the rule out loud. “All of these must be true” means AND. “Any of these is enough” means OR.
  3. Too many nested IFs. After two or three levels, switch to IFS or a lookup table. It is easier to maintain.
  4. Ranges of different sizes in AND/OR. If you pass arrays instead of single cells, AND returns a single value, not an array. Be careful in array formulas.
  5. Comparing text to numbers. “5000” is not the same as 5000. Make sure data types match.
  6. Forgetting that IF is not the only option. For a simple “if this, then that” mapping, a lookup table may be cleaner.

Using IFS Instead of Nested IFs

If you have several tiers, IFS is cleaner:

=IFS(B2>=80000, "Excellent", B2>=60000, "Good", B2>=40000, "Average", TRUE, "Below Target")

The final TRUE acts as the default. This is easier to read than three nested IFs. IFS is available in newer Excel versions.

IFERROR for Clean Error Handling

Sometimes formulas return errors like #N/A or #DIV/0!. IFERROR wraps the formula and returns a clean result instead.

=IFERROR(VLOOKUP(A2, Products!A:D, 4, FALSE), "Not found")

This returns “Not found” instead of an error. IFERROR is often combined with IF, AND, and OR to make formulas robust in real reports.

A Small Exercise to Try

Type a small student table in A1:D11 with the headers Name, Marks, Attendance %, and a blank Result column. In D2, write a formula that returns Pass only when marks are 40 or more AND attendance is 75% or more: =IF(AND(B2>=40, C2>=75), “Pass”, “Fail”). Copy it down and check a few rows by hand. Now add a grade column: in E2 use nested IFs to return A for 90 or more, B for 75 or more, C for 60 or more, and D otherwise. Then replace that nested IF with a single IFS formula and confirm the results are identical.

Next, try OR. Add a column that flags Scholarship when marks are 90 or more OR attendance is 100%: =IF(OR(B2>=90, C2=100), “Scholarship”, “-“). Finally, combine all three: a formula that returns Distinction when marks are 85 or more AND attendance is 90% or more, OR marks are 95 or more. Read the rule out loud before typing it, and group the AND and OR parts in your head first. If a result looks wrong, split the test into helper cells, one cell for the AND part and one for the OR part, and check each separately.

Frequently Asked Questions

Can IF return another formula?

Yes. You can nest almost anything inside IF, including lookups, text functions, and other IF statements.

What is the difference between AND and OR in simple words?

AND means all conditions must be true. OR means at least one condition must be true.

Can I use IF with dates?

Yes. For example, =IF(A2>TODAY(), “Upcoming”, “Past”) checks if a date is in the future.

How many conditions can AND or OR handle?

Excel allows up to 255 arguments, but for readability, keep it to 3 or 4. Beyond that, split the logic into separate cells.

Can I combine NOT with IF AND OR formulas?

Yes. NOT works inside IF, AND, and OR. For example, =IF(AND(NOT(C2=”Delivered”), B2>=5000), “Chase”, “OK”) flags only large orders that are not delivered yet. Keep it to one NOT per test so the formula stays readable.

When should I use SWITCH instead of nested IF?

Use SWITCH when one cell is compared against a short list of exact values, such as status codes or customer types. It is shorter than a chain of nested IFs. For ranges like scores or revenue bands, IFS is the better choice.

IF with NOT

NOT flips a condition around, so it is the fourth logical function worth learning. The syntax is:

=NOT(logical)

NOT(TRUE) returns FALSE, and NOT(FALSE) returns TRUE. On its own that looks pointless, but inside IF it lets you write the rule the way you say it. Suppose you want to flag every order that is not delivered yet:

=IF(NOT(C2="Delivered"), "Follow Up", "Done")

Without NOT you would have to swap the two outcomes. NOT keeps the formula readable when the rule itself is negative — “if this has not happened yet, do that.”

NOT also works with AND and OR. This formula marks an employee for review only when neither target is met:

=IF(NOT(OR(B2>=50000, C2>=90)), "Review", "OK")

Avoid double negatives such as NOT(NOT(…)) — rewrite the test in positive form instead. NOT completes the IF AND OR set of tools, and it works best when the rule is naturally an exception rather than a pass.

Nested IF vs IFS vs SWITCH

Once a formula needs more than two or three outcomes, nested IF becomes hard to read and easy to break. That is when IFS and SWITCH earn their place.

Nested IF checks conditions in order and returns the first match. It works in every Excel version, so use it for two or three tiers in old files.

IFS checks a list of condition-and-result pairs in order and returns the first true one. It is cleaner than nested IF for tiers, and the final TRUE pair acts as the default:

=IFS(B2>=80000, "Excellent", B2>=60000, "Good", TRUE, "Below Target")

Use IFS for grading, banding, or sorting values into ranges (Microsoft 365 or Excel 2019 or later).

SWITCH matches one value against a list of exact values and returns the result for the match. It is cleanest when you map codes to labels:

=SWITCH(C2, "VIP", "15% Discount", "Regular", "10% Discount", "No Discount")

Use SWITCH when one cell is tested against a fixed set of exact values, not ranges. Choosing between nested IF, IFS and SWITCH is the next step after you master IF AND OR combinations: tiers and ranges point to IFS, exact code-to-label mapping points to SWITCH, and old files point to nested IF.

Related guide: INDEX MATCH Explained: Why It Beats VLOOKUP → https://excelformulatutorials.info/index-match-excel/

Related guide: How to Analyze Sales Data in Excel with Pivot Tables → https://excelformulatutorials.info/how-to-analyze-sales-data-excel-pivot-tables/

Final Thoughts

IF, AND, and OR are simple on their own and powerful when combined. The key is to think in plain language before you write the formula. Say the rule out loud. Does it need all conditions? Use AND. Any condition? Use OR. Then wrap it inside IF.

If you build the habit of writing short, readable formulas, your spreadsheets will be easier to debug, easier to hand over to a colleague, and less likely to break when the data changes.

Leave a Comment