IF, AND, OR and IFS: Writing Formulas With Conditions
Basic IF
=IF(B2>=50, "Pass", "Fail")
IF with AND / OR
=IF(AND(B2>=50, C2="Yes"), "Approved", "Review")
=IF(OR(B2="", C2=""), "Missing data", "OK")
Several outcomes: IFS
=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "F")
The final TRUE acts as the "everything else" case. IFS is in Excel 2019 and later and Google Sheets. In older versions, nest IFs instead: =IF(B2>=90,"A",IF(B2>=80,"B","C"))
Tips
Text in conditions needs double quotes; numbers do not. Order the conditions from strictest to loosest, since the first match wins. The same conditions work inside conditional formatting: see how to highlight an entire row based on a cell value.
Sorting people into age bands? Start with calculating age from date of birth.
Prefer a ready-made file?
- Excel & Google Sheets Formula Cheat Sheet (50 tested formulas + practice workbook) (US$4, Payhip): 50 formulas for lookups, SUMIFS, IF, text, dates, percentages and FILTER/UNIQUE, each shown with its result, plus an error-fix page and a practice workbook.