← All how-to recipes

How to write an IF with multiple conditions (AND / OR)

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Return one result only when several conditions are all true (or when any is true).

The formula

AppFormulaNotes
Excel (desktop)=IF(AND(A2>=60,B2>=60),"Pass","Fail")AND requires all conditions true; swap in OR() to require any one.
Google Sheets=IF(AND(A2>=60,B2>=60),"Pass","Fail")Identical.
LibreOffice Calc=IF(AND(A2>=60,B2>=60),"Pass","Fail")Identical.

How it works

AND(cond1, cond2, ...) is TRUE only when every condition is true, so IF returns 'Pass' only when both scores are at least 60. Here 75 and 80 both pass. Replace AND with OR to return 'Pass' when at least one condition is met.

Verified, not just documented

We ran =IF(AND(A2>=60,B2>=60),"Pass","Fail") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned Pass — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned Pass for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

IF · AND — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons