Excel Practice Test

โ–ถ

If you have ever stared at a spreadsheet and thought, "I need this cell to do one thing if a value is high and the category is right, but something else if either condition fails," you have already met the excel if or and statement in the wild. It is the cornerstone of nearly every decision-making formula in a workbook โ€” from grading sheets to commission calculators to inventory alerts. Get it right once, and you will rewrite half your spreadsheets in a single afternoon.

This guide walks through the logic plainly, with the formulas you can copy, paste, and tweak. We will start with the basic IF structure, layer in OR and AND, climb into nested logic, and finish with the newer IFS and SWITCH functions that quietly make life easier. Along the way, you will see the common traps โ€” missing parentheses, swapped logic, the silent text-versus-number gotchas that turn good formulas into stubborn errors.

You do not need a programming background. You do need patience for parentheses. By the end, you will read a formula like =IF(AND(OR(A1="VIP", A1="Member"), B1>100), "Discount", "Regular") and see the logic the same way a chess player reads a position โ€” at a glance, with the next move already half-planned.

The Basic IF Function

Every conversation about Excel logic starts with the same three-part question. What are we testing? What happens if true? What happens if false? That is IF, written exactly the way it reads:

=IF(condition, value_if_true, value_if_false)

So if A1 holds a test score, and you want "Pass" for 70 or higher, the formula is =IF(A1>=70, "Pass", "Fail"). That is it. The condition can be a comparison (>, <, =, <>), a reference to a logical cell, or a function that returns TRUE or FALSE.

Where it gets interesting โ€” and where most people first hit a wall โ€” is when one condition is not enough. Real-world decisions almost always have a twist. Pass if the score is 70 or higher AND attendance is above 80%. Apply discount if customer is VIP OR if order total is above $100. That is when OR and AND walk in.

Worth practicing? Yes. Worth memorizing? Mostly. Worth thinking about as a habit? Absolutely. Skim the formulas now; you will be writing them tonight.

Excel Logical Function Stats

64
Max IF nesting levels
255
Max conditions in OR/AND
2019
IFS function introduced
0.4s
Lookup vs 14s nested IF

Combining IF with OR โ€” Any Condition Wins

The OR function asks a simple question: is at least one of these true? If the answer is yes, the whole thing returns TRUE. Stack it inside an IF and you get a formula that fires whenever any condition is met.

=IF(OR(A1>10, B1<5), "Yes", "No")

This returns "Yes" if A1 is greater than 10 or if B1 is less than 5 โ€” or both. Only when neither condition is true does it fall through to "No". Think of OR as the friendly bouncer who lets you in if you have a ticket or if you know the band.

Practical use? A discount tier formula. Say you offer a discount to Wholesale customers or VIP members regardless of order size. =IF(OR(A2="Wholesale", A2="VIP"), 0.15, 0). One quick formula and your whole pricing column rewrites itself.

You can stack more conditions inside OR โ€” up to 255 of them. =IF(OR(A1="NY", A1="CA", A1="TX", A1="FL"), "Priority", "Standard"). Yes, it works. No, you should not actually nest 255 โ€” but five or six? Common.

Combining IF with AND โ€” Every Condition Must Pass

Now flip the logic. AND asks: are all of these true? Miss one โ€” even by a hair โ€” and the whole thing collapses to FALSE.

=IF(AND(A1>10, B1<5), "Yes", "No")

Both A1 and B1 must clear their thresholds. If either fails, the result is "No". AND is the strict bouncer. Ticket and ID and dress code. Everyone passes, or no one does.

Real example โ€” a bonus calculator. Pay a bonus only when an employee has more than three years of service and a performance score above 4.0. =IF(AND(C2>3, D2>4), "Bonus", ""). Clean. Readable. No room for fudging.

What about date ranges? AND shines there. =IF(AND(A2>=DATE(2026,1,1), A2<=DATE(2026,12,31)), "In Range", "Out"). Both ends of the range must be satisfied. One of the cleanest patterns you will use.

AND vs OR โ€” One Sentence

AND means every condition must pass. OR means at least one wins. If you confuse them, your discount column will give bonuses to people who deserve nothing โ€” or block them from everyone.

Nested IF Statements โ€” Multiple Branches

Sometimes you do not want a simple yes/no โ€” you want a ladder. A grade goes from A to F based on score. A shipping tier depends on weight bracket. A discount changes by quantity ordered. That is when one IF rolls into another.

=IF(A1>=90, "A", IF(A1>=80, "B", IF(A1>=70, "C", IF(A1>=60, "D", "F"))))

Read it top to bottom โ€” Excel does the same. If 90 or higher, A. Otherwise, check 80. If yes, B. Otherwise, check 70. And so on. Each false branch hands off to the next IF, like a relay race.

Excel allows up to 64 levels of nesting. Should you go anywhere near that? No. Past five or six nests, the formula becomes a maintenance nightmare. You will count parentheses with your finger, miss one, and lose 20 minutes debugging at midnight. Trust me.

Two truths about nested IFs: they work, and they get ugly fast. The first three levels are fine. By the fifth, the formula starts looking like a regex from a fever dream. That is where the next tool โ€” IFS โ€” pays for itself.

The Four Function Families

๐Ÿ”ด IF

Single condition. The starting point for every logical formula.

๐ŸŸ  OR / AND

Boolean combiners. Wrap them inside IF for compound logic.

๐ŸŸก IFS

Flat replacement for deep IF nesting. Available Excel 2019+.

๐ŸŸข SWITCH

Exact-match mapping table inside a single function call.

The IFS Function โ€” Cleaner Multiple Conditions

If you have Excel 2019, Excel 365, or Excel for the web, you have IFS. It replaces the staircase of nested IFs with a flat, easier-to-read list of condition/value pairs.

=IFS(A1>=90, "A", A1>=80, "B", A1>=70, "C", A1>=60, "D", TRUE, "F")

Read left to right. First condition true wins. The trailing TRUE, "F" is the catch-all โ€” like an "else" clause in a programming language. Without it, anything below 60 returns #N/A, which is rarely what you want.

Why does this matter? Visual clarity. A nested IF with five levels makes you mentally unwind four sets of parentheses. IFS reads like a switchboard โ€” flick the first switch that fires, done. Same logic, half the cognitive load.

One gotcha: IFS does not exist in Excel 2016 or earlier. If you share workbooks with people on older versions, stick with nested IFs or use a lookup table approach. Better to be boring and compatible than clever and broken.

The SWITCH Function โ€” Exact Match Testing

SWITCH is the unsung hero of formula writing. When you need to test a value against a list of exact matches โ€” not ranges, not greater-than โ€” SWITCH wins hands down.

=SWITCH(A1, "Mon", 1, "Tue", 2, "Wed", 3, "Thu", 4, "Fri", 5, 0)

This converts day abbreviations to numbers. If A1 is "Mon", it returns 1. If "Tue", 2. Anything not on the list defaults to 0 (the trailing value). No nested IFs. No OR chains. Just a clean mapping table inside a single function.

Use SWITCH when your condition is "does this exactly equal X?" Use IFS when you need ranges or compound logic. They are siblings โ€” not duplicates.

Function Showdown

๐Ÿ“‹ Nested IF

Use when you need ranges or compound conditions on older Excel versions. Readable up to 3โ€“4 levels. Past that, switch to IFS or VLOOKUP. Syntax: =IF(test1, val1, IF(test2, val2, val3)).

๐Ÿ“‹ IFS

Use when you want flat, readable multi-branch logic on Excel 2019, 365, or Online. Same range capability as nested IF, fraction of the parentheses. End with TRUE, default for catch-all.

๐Ÿ“‹ SWITCH

Use when testing one value against a list of exact matches. Cleaner than chained IFs for lookups like day-to-number or status-to-color. No greater-than logic โ€” exact equality only.

๐Ÿ“‹ VLOOKUP / XLOOKUP

Use when your decision logic exceeds five branches or changes frequently. A lookup table is editable without touching formulas. XLOOKUP (Excel 365) replaces VLOOKUP with a cleaner, two-way version.

Complex Nested Logic โ€” Combining AND, OR, and IF

Here is where the real power shows up. You can nest AND and OR inside each other to model genuinely complex decisions. A favorite of mine:

=IF(AND(OR(A1="VIP", A1="Member"), B1>100), "Discount", "Regular")

Read it inside-out. First, OR(A1="VIP", A1="Member") โ€” is this customer either VIP or a member? Then, AND(...that, B1>100) โ€” and is their order total over $100? Both must be true to earn the discount. Anything else: regular pricing.

This kind of layered logic models how humans actually make decisions. Loyalty plus spend threshold. Date range plus product category. Department plus pay grade. Each business rule has a shape, and AND/OR nesting lets you sketch it directly into the cell.

The trick is to build it in pieces. Write the OR alone first, confirm it returns TRUE or FALSE as expected, then wrap the AND, then the outer IF. Test at each step. Skip that habit and you will spend more time hunting parentheses than writing logic.

Test Your Excel Skills โ€” Take a Quick Practice Quiz

Common Patterns You Will Reuse Forever

A handful of patterns show up in nearly every spreadsheet that grows past a hundred rows. Memorize the shape, not the specifics:

Bonus calculator โ€” combine years of service and performance score. =IF(AND(YearsService>=3, PerfScore>=4), Salary*0.1, 0). Both metrics must clear the bar.

Discount tier โ€” OR Wholesale OR VIP. =IF(OR(CustomerType="Wholesale", CustomerType="VIP"), Price*0.85, Price). Either status earns the price break.

Date range check โ€” AND start โ‰ค date โ‰ค end. =IF(AND(OrderDate>=StartDate, OrderDate<=EndDate), "In Period", "Out"). Both fence posts must be inside.

Form validation โ€” multiple required fields all non-empty. =IF(AND(A2<>"", B2<>"", C2<>""), "Complete", "Missing Data"). Three filled cells, you pass.

Threshold alert โ€” either inventory low OR sales spike. =IF(OR(Inventory<10, SalesThisWeek>100), "Reorder", "Hold"). One trigger fires the action.

None of these are exotic. All of them save 10โ€“20 minutes a week once they become reflex. Practice with the excel formulas reference and you will internalize the shapes faster than you expect.

Pre-Flight Checklist Before You Run That Formula

Count opening and closing parentheses โ€” they must match.
Confirm AND vs OR matches the business rule, not the other way around.
Wrap all text comparisons in double quotes.
Test with at least one boundary value (e.g., exactly 70).
Test with one blank cell to confirm null behavior.
Use Named Ranges if the formula will outlive this week.
Save a backup before refactoring nested IFs into IFS.
Document edge cases in a comment cell next to the formula.

Common Errors and How to Fix Them

Even seasoned spreadsheet hands trip on these. Here are the usual suspects:

Missing parentheses. The single most common error. Excel highlights matching parens as you click through a formula โ€” use it. If you see #N/A or a syntax warning, count open and close. They must match exactly.

Swapped AND and OR logic. Easy to do at 4 PM on a Friday. AND requires all; OR requires any. If your formula returns FALSE when you expected TRUE, swap them mentally and see if the result flips correctly.

Comparing text without quotes. =IF(A1=Yes, ...) looks at a cell named "Yes" or returns an error. You meant =IF(A1="Yes", ...). Quotes turn the word into a string Excel can match.

Null cell handling. A blank cell can pass as zero in comparisons. =IF(A1>0, ...) will treat empty as not greater than zero โ€” fine. But =IF(A1="", ...) is the explicit check when you actually mean "blank". Mix them up and you get phantom results.

Mismatched data types. "5" as text and 5 as a number do not compare equal. If your column was imported from CSV, every value might be text. Wrap with VALUE() or convert the column first.

Nested IF vs IFS Function

Pros

  • IFS reads flat โ€” left to right, no parenthesis pyramid.
  • IFS faster to write and edit for 4+ branches.
  • IFS easier to debug โ€” each condition stands alone.
  • IFS slightly faster recalculation in large workbooks.
  • IFS supports the same range comparisons as nested IF.

Cons

  • IFS unavailable in Excel 2016 and earlier โ€” compatibility risk.
  • Nested IF works everywhere โ€” even ancient versions.
  • Sharing IFS workbooks with older-version users breaks formulas.
  • Nested IF still better for very simple 2โ€“3 branch logic.
  • IFS requires the explicit TRUE catch-all or returns #N/A.

Best Practices โ€” Keeping Formulas Readable

Working logic is only half the battle. Readable logic is the other half โ€” because you (or someone else) will revisit this sheet in six months and need to understand it in 30 seconds.

Limit nesting depth. Five-plus levels of IF? Switch to IFS or a VLOOKUP/XLOOKUP table. A reference table makes the logic visible โ€” a 12-level IF makes it invisible. See the how to use excel guide for table-driven patterns.

Use Named Ranges. Instead of =IF(AND(B2>3, C2>4), ...), define names: =IF(AND(YearsService>3, PerfScore>4), ...). The formula reads like English. Onboarding a coworker drops from hours to minutes.

Comment with helper cells. Put intermediate results in their own cells with labels. D2 = AND(YearsService>3, PerfScore>4), then E2 = IF(D2, "Bonus", ""). Slower? Slightly. More debuggable? Hugely.

Test edge cases. What happens at exactly 90? At 0? At blank? At negative numbers? Build a row of test inputs covering boundaries. Find the bug before your audit committee does.

Indent in the formula bar. Press Alt+Enter inside the formula bar to add line breaks. Nested IFs become readable like code. Excel ignores the whitespace; you understand the structure.

Performance โ€” When Your Formulas Slow Things Down

Deeply nested IFs are not just ugly โ€” they slow large sheets. Each branch is evaluated when Excel recalculates. With 50,000 rows and a six-deep nest, you can feel the lag.

Three rules of thumb:

Switch to IFS for ladders. Same logic, faster to parse, easier on the recalc engine.

Use VLOOKUP or XLOOKUP with a table. A 12-row lookup table beats a 12-level IF every time โ€” for speed, readability, and editability. Want to change a tier? Edit the table, not the formula. The microsoft excel guide covers lookup strategies in depth.

Avoid volatile functions inside IFs. NOW(), TODAY(), OFFSET(), INDIRECT() all force recalculation on every change. Nesting them inside IFs in 10,000 rows? Recipe for a sluggish workbook.

A real-world example: a finance team I worked with had a 7-level nested IF across 200,000 rows. Recalc took 14 seconds on every edit. Refactored to a lookup table โ€” 0.4 seconds. Same logic. Same output. Same business rules. Just a different shape.

Platform Compatibility โ€” Mac, Windows, Online, VBA

Excel keeps formulas identical across platforms. IF, AND, OR, IFS, SWITCH โ€” all work identically on Mac and Windows. Excel Online supports them too. No syntax tweaks needed. No "this works on Windows but not Mac" surprises. The cross-platform parity is genuinely rare in software, and Excel has stuck with it for decades.

VBA is the exception. Inside macros, you use the structured form: If...Then...Else...End If. Same logic, procedural syntax. VBA uses And and Or as keywords, not function calls. No parentheses around arguments. The grammar is closer to BASIC than to spreadsheet formulas.

For everyone else โ€” the worksheet formula form is universal. Even on a phone via Excel for iOS and Android, the formulas evaluate the same way. Write once, evaluate everywhere. That portability is what makes the IF/OR/AND family worth investing time in โ€” your skills travel with you across versions and machines, year after year.

Putting It All Together

You now have the full toolkit. Basic IF. OR for any-condition matches. AND for all-required. Nested IFs for ladders. IFS for cleaner multi-branch logic. SWITCH for exact matches.

Start small. Pick one spreadsheet, find a column where you are manually classifying values, and replace it with a formula. Test it. Break it on purpose. Repeat next week. For more on the basics, the excel guide covers the foundation.

Excel Questions and Answers

What does the IF OR AND statement do in Excel?

It lets you test multiple conditions in a single formula. Wrap OR or AND inside IF, and the function returns one value when the conditions are met and another when they are not. It is the standard pattern for any decision involving more than one criterion โ€” like awarding a discount when a customer is VIP or a member, and their order is above a threshold.

How do I write a nested IF statement?

Replace the false-value argument of one IF with another IF. Example: =IF(A1>=90, "A", IF(A1>=80, "B", "C")). Excel evaluates top-down, so the first condition that returns TRUE wins. Keep nesting under five levels โ€” past that, switch to IFS or a lookup table for maintainability.

When should I use IFS instead of nested IF?

Use IFS any time you have four or more branches, or when you are on Excel 2019, 365, or Excel for the web. IFS reads flat โ€” condition/value pairs in a row โ€” instead of stacking parentheses. It is faster to write, easier to debug, and slightly faster for the recalc engine. The only reason to stick with nested IF is compatibility with Excel 2016 or older.

What is the difference between AND and OR in Excel?

AND returns TRUE only when every condition is true โ€” miss one and it returns FALSE. OR returns TRUE if at least one condition is true โ€” only when all are false does it return FALSE. They are complementary tools. AND for strict requirements (all boxes checked), OR for any-of matches (any path qualifies).

How many conditions can I put in an OR or AND function?

Up to 255 arguments. In practice, anything past five or six conditions becomes hard to read and audit. If you find yourself listing 10 cities or 15 product codes inside OR, switch to a lookup table or use the COUNTIF / MATCH approach to test membership in a list โ€” far cleaner than a wall of OR arguments.

Can I use IF OR AND in Excel for Mac and Excel Online?

Yes. IF, OR, AND, IFS, and SWITCH all behave identically on Mac, Windows, and Excel for the web. There is no syntax difference. Formulas written on one platform open and evaluate correctly on every other platform. VBA macros use slightly different procedural syntax (If...Then...Else...End If) but worksheet formulas are universal.

What causes #N/A or #VALUE errors in IF formulas?

Most often: missing parentheses, comparing a number cell to a text value without quotes, or an IFS formula without a TRUE catch-all where no condition matched. Check the formula bar โ€” Excel highlights paren pairs as you click through. Confirm data types with =ISNUMBER() or =ISTEXT() if comparisons return unexpected results.

How do I make complex IF formulas easier to read?

Three habits: use Named Ranges instead of cell references (YearsService beats B2), break long formulas across lines with Alt+Enter inside the formula bar, and split intermediate results into helper cells. A six-deep formula spread across three labeled cells is easier to debug than a single monster formula โ€” even if it takes one extra row.
Ready to Master Excel? Start the Practice Quiz
โ–ถ Start Quiz