How to do multiple if statements in excel
Tutor 5 (50 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To do multiple IF statements in Excel, use one of these methods: nested IF, IFS, IF combined with AND/OR, SWITCH, or INDEX/MATCH. Choose the method that is clearest and easiest to maintain for your situation.
Method 1 — Nested IF (classic)
A nested IF places one IF inside another to test multiple conditions in order.
-
Use nested tests when each condition is checked sequentially.
-
Place the most likely or highest-priority test first.
-
Watch out for readability; many levels become hard to maintain.
Example formula (grade from score in A2):
\texttt{=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C",IF(A2>=60,"D","F"))))}
Notes:
-
Modern Excel supports up to 64 nested
IFlevels. -
Older Excel versions prior to 2007 permitted only 7 nested levels.
Method 2 — IFS (cleaner for many mutually exclusive conditions)
IFS evaluates pairs of condition/result without deep nesting and stops at the first TRUE.
-
Use
IFSwhen conditions are mutually exclusive and you have Excel that supports it. -
Provide a final TRUE condition to act as a default catch-all.
Example formula (same grade example):
\texttt{=IFS(A2>=90,"A",A2>=80,"B",A2>=70,"C",A2>=60,"D",TRUE,"F")}
Compatibility note:
-
IFSis available in Excel for Microsoft 365 and modern standalone Excel versions. -
If
IFSis unavailable, use a nestedIF.
Method 3 — IF with AND / OR (composite conditions)
Combine IF with AND or OR when a single test depends on multiple criteria.
-
Use
ANDwhen all conditions must be true. -
Use
ORwhen any single condition being true suffices.
Example: bonus if sales in A2 exceed 100 and region in B2 equals "East":
\texttt{=IF(AND(A2>100,B2="East"),"Bonus","No Bonus")}
Example: apply discount when product is "A" or "B":
\texttt{=IF(OR(C2="A",C2="B"),"Discount","No Discount")}
Method 4 — SWITCH (exact match branching)
SWITCH selects a result based on an expression matching one of several values.
-
Use
SWITCHfor clean exact-value branching. -
Provide a default value at the end.
Example: return department name using code in A2:
\texttt{=SWITCH(A2,1,"Sales",2,"HR",3,"IT","Unknown")}
Compatibility note:
-
SWITCHexists in Microsoft 365 and recent Excel versions. -
Legacy Excel versions may not support
SWITCH.
Method 5 — INDEX + MATCH or LOOKUP (scalable and maintainable)
Use a lookup table when many conditions map to outcomes; this keeps formulas short and editable.
-
Create a two-column table: criteria in column E, results in column F.
-
Use
MATCHto find the row andINDEXto return the result.
Example using exact match with lookup table in E:F:
\texttt{=INDEX(F:F,MATCH(A2,E:E,0))}
Use VLOOKUP with exact match as an alternative:
\texttt{=VLOOKUP(A2,E:F,2,FALSE)}
Best practices and debugging
-
Order tests by priority to avoid incorrect early matches.
-
Use a default or catch-all result at the end to handle unexpected inputs.
-
Use named ranges or lookup tables for complex mappings to simplify edits.
-
Wrap comparisons with
TRIMorUPPERwhen text inconsistencies may occur. -
Use
Evaluate Formulaon the Formulas tab to step through nested logic. -
Avoid very long nested
IFchains whenIFS,SWITCH, or lookup tables will be clearer.
Windows vs Mac differences
-
Function names and behavior are the same on current Windows and Mac Excel versions.
-
IFS,SWITCH, and dynamic-array behavior require Microsoft 365 or recent perpetual-license builds on both platforms. -
Keyboard shortcuts for formula auditing or entering array formulas differ by platform, but modern dynamic arrays remove most array-entry differences.
Quick reference formulas (copy-ready LaTeX code blocks)
Nested IF (grades):
\texttt{=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C",IF(A2>=60,"D","F"))))}
IFS (grades):
\texttt{=IFS(A2>=90,"A",A2>=80,"B",A2>=70,"C",A2>=60,"D",TRUE,"F")}
IF with AND:
\texttt{=IF(AND(A2>100,B2="East"),"Bonus","No Bonus")}
SWITCH (codes):
\texttt{=SWITCH(A2,1,"Sales",2,"HR",3,"IT","Unknown")}
INDEX + MATCH lookup:
\texttt{=INDEX(F:F,MATCH(A2,E:E,0))}
Common questions (Q&A)
How do I choose between nested IF and IFS?
Choose IFS when it is available and your conditions are mutually exclusive because IFS is easier to read and maintain. Choose nested IF for compatibility with older Excel versions.
Can I use multiple conditions that must all be true?
Yes. Use AND within an IF to require multiple true conditions, for example:
\texttt{=IF(AND(A2>100,B2="East"),"Bonus","No Bonus")}
What if I have many mappings that might change?
Use a lookup table with INDEX/MATCH or VLOOKUP. This keeps logic in a table you can edit without rewriting formulas.
Use the approach that keeps your workbook easiest to read and maintain.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
Why is today function not working
Answers · 1
How to extract date from datetime in excel
Answers · 1
Why is the date value not working
Answers · 1
How to create a date formula
Answers · 1