IF AND Formula

If you just need to if and formula and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: combine IF and AND to test multiple conditions simultaneously — =IF(AND(A1>0,B1>0),"Yes","No") returns "Yes" only when both conditions are true.

On this page8

Formula: IF with AND

=IF(AND(A1>0,B1>0),"Yes","No")
▤Annotated stepsExcel
1

Identify all conditions that must be true simultaneously.

2

Write =AND(condition1, condition2, …) and test it alone to confirm it returns TRUE/FALSE as expected.

3

Wrap in IF: =IF(AND(condition1, condition2), value_if_true, value_if_false)

4

Press Enter and copy down.

5

For "any condition" instead of "all conditions", replace AND with OR.

Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

The IF/AND combination tests whether all of a set of conditions are simultaneously true before returning a result. AND() returns TRUE only when every argument inside it evaluates to TRUE; wrapping it in IF() lets you branch on that combined result. This is the standard Excel pattern for "only if all criteria are met" logic — approving a loan when credit score AND income both exceed thresholds, flagging a row only when two columns both match, or applying a discount when a customer AND their order both qualify. AND() accepts up to 255 arguments, so you can stack many conditions without nesting. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. For “if and formula”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected formula change, and only then apply the same setup to the full sheet. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. That is what makes a workflow that saves repeating the same clicks every week useful in real work: repeatable, auditable, and not dependent on memory or luck.

A worked example

Scenario: you want to flag rows where both column A (quantity) and column B (price) are greater than zero — meaning the row has a real sale. Enter =IF(AND(A1>0,B1>0),"Yes","No") in C1. If A1=5 and B1=12, AND(5>0,12>0) evaluates to TRUE, so IF returns "Yes". If A1=0 and B1=12, AND evaluates to FALSE (because 0>0 is FALSE), so IF returns "No". Copy the formula down column C. To extend: =IF(AND(A1>0,B1>0,C1<>"Cancelled"),"Valid","Invalid") adds a third condition. Use IF/AND whenever the positive outcome requires every criterion to be satisfied. It is cleaner and more readable than an equivalent nested IF chain, and it evaluates all conditions in a single pass. Colleagues can scan =IF(AND(A1>0,B1>0,C1="Active"),"Yes","No") instantly; the same logic in nested IFs takes three levels of brackets to say the same thing. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

The standard worksheet functions used by this example are listed in Google Sheets. Check the cell references, argument separators and input types in the target spreadsheet, then compare the worked result. This formula-availability check does not establish identical menus, keyboard shortcuts or workbook features, and it is not a product execution test. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. For “if and formula”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Confusing AND with nested IF — AND(A1>0,B1>0) tests both conditions at once; IF(A1>0,IF(B1>0,…)) tests them sequentially. Both are correct but AND is more readable for simultaneous criteria.
  • Using AND outside IF — AND() returns TRUE or FALSE, which Excel displays as the text "TRUE"/"FALSE" in a cell. Wrap it in IF to return a more meaningful result.
  • Forgetting that AND returns FALSE if ANY argument is FALSE — if you need "at least one true", use OR() instead.

Frequently asked questions

What is the difference between IF(AND(…)) and nested IF?

AND tests all conditions simultaneously and returns TRUE only if every one passes. Nested IF tests conditions in sequence, branching differently for each. Use AND when all conditions must be met for one result; use nested IF when different combinations of conditions lead to different results.

Can I combine IF with both AND and OR?

Yes: =IF(AND(A1>0,OR(B1="Yes",C1="Yes")),"Flag","") requires A1>0 AND at least one of B1 or C1 to equal "Yes". Combine AND/OR freely inside the IF condition argument.

How many conditions can AND() test?

AND() accepts up to 255 logical arguments. In practice, keep it under 5–6 for readability; for more complex rule sets consider a helper column or a lookup table.

Other ways people ask this

On the way here you may have searched this as “if and function in excel”, “multiple if and statements in excel”, “excel formula if and” and “how to use and function in excel with if” — it is all the same task, and this page is the single, complete answer to it.

Why do people search for this in so many different ways?

Because the same task has many names. “if and function in excel”, “multiple if and statements in excel”, “excel formula if and” all point at the one operation explained on this page, which is why they all lead here.