Conditions · IF (nested), AND, OR
Nested IF and IF with AND / OR in Excel
Put an IF inside another IF to test several levels (High / Medium / Low), and use AND / OR to test several conditions at once.
=IF(test1, value1, IF(test2, value2, value3)) =IF(AND(test1, test2), yes, no)Write it for my sheet
Examples
| Type this in the Formula Studio | Formula |
|---|---|
| “if D2 > 50000 then High, if D2 > 30000 then Medium else Low” | =IF(D2>50000,"High",IF(D2>30000,"Medium","Low")) |
| “if D2 > 30000 and E2 > 15000 then Yes else No” | =IF(AND(D2>30000,E2>15000),"Yes","No") |
Tips
- Excel 365 also has IFS, which reads more easily for many levels.
People also search for
FAQ
How do I write an IF with 3 outcomes?
Nest one IF inside another: =IF(D2>50000,"High",IF(D2>30000,"Medium","Low")). Test the largest threshold first.
What is the difference between AND and OR inside IF?
AND returns TRUE only if all conditions are true; OR if any one is. Example: =IF(AND(D2>30000,E2>15000),"Yes","No").
Can LoveByPDF write this formula for me?
Yes. Open your Excel file in the Excel Agent's Formula Studio, click a cell and type what you need - e.g. "if D2 > 50000 then High, if D2 > 30000 then Medium else Low" - you get the formula, a preview on your sheet and an explanation, then insert it.
Related formulas
- IFIF formula in Excel - with examples in plain words
- IFERRORIFERROR in Excel - hide #DIV/0!, #N/A and other errors
- SUMIF, SUMIFSSUMIF and SUMIFS in Excel - add up with conditions
- COUNTIF, COUNTIFSCOUNTIF in Excel - count cells that match (attendance P / A / L)
- SUMSUM formula in Excel - add up cells, rows and columns
- AVERAGEAVERAGE formula in Excel - the mean of a range
- COUNT, COUNTA, COUNTBLANKCOUNT vs COUNTA vs COUNTBLANK - counting cells in Excel
- MAX, MINMAX and MIN in Excel - highest and lowest value