# IF AND Statements in Excel: Syntax and Examples

If and statements in Excel combine two functions into one formula. The AND function tests several conditions at the same time and returns TRUE only when every condition is met. The IF function then turns that TRUE or FALSE into the result you want to display, such as "Pass" or "Fail". This pattern is one of the most common ways to apply an and if condition in Excel to real data.

## Quick Answer

- The pattern is `=IF(AND(condition1, condition2), value_if_true, value_if_false)`.
- AND returns TRUE only if every condition inside it is true. One false condition makes the whole test FALSE.
- IF then returns the first value when the test is TRUE and the second value when it is FALSE.
- Conditions use comparison operators such as `>=`, `<=`, `=`, `<>`, `>` and `<`.
- You can test more than two conditions by adding them inside AND, separated by commas.

## Before You Start

You need a table with at least two numeric or logical columns to test. In the example below, one column holds exam scores and another holds attendance rates. Both are numbers, so both can be compared against thresholds.

It helps to write your conditions in plain language first. For a student to pass, the score must be at least 60 and attendance must be at least 0.8. That sentence maps directly onto the formula. Each "and" in your sentence becomes a comma inside the AND function.

Parentheses matter here. The AND function has its own pair of brackets, and those brackets sit inside the IF function's brackets [1]. If you drop one, Excel cannot tell where the AND test ends and the IF arguments begin.

Decide what the formula should return before you type it. Text results need quotation marks, like `"Pass"`. Numbers do not. If you want a blank cell when the test fails, use `""` as the false result.

## Step by Step

1. Click the cell where you want the result, such as D2.
2. Type `=IF(` to start the formula.
3. Type `AND(` to open the logical test.
4. Enter your first condition, such as `B2>=60`.
5. Type a comma, then enter the second condition, such as `C2>=0.8`.
6. Close the AND function with `)`.
7. Type a comma, then the value to return when both conditions are true, such as `"Pass"`.
8. Type a comma, then the value to return otherwise, such as `"Fail"`.
9. Close the IF function with `)` and press Enter.
10. Copy the formula down the column so each row tests its own values.

The finished formula looks like this.

```
=IF(AND(B2>=60,C2>=0.8),"Pass","Fail")
```

When you copy this down, the row references shift automatically. Row 3 becomes `B3` and `C3`, row 4 becomes `B4` and `C4`, and so on. That relative referencing is what lets one formula handle an entire column.

## Worked Example

The table below holds six students with a score and an attendance rate. Column D uses an IF AND formula to flag each student as Pass or Fail. A student passes only when the score is at least 60 and attendance is at least 0.8.

|   | A | B | C | D |
|---|---|---|---|---|
| 1 | Student | Score | Attendance | Result |
| 2 | Ana | 78 | 0.92 | `=IF(AND(B2>=60,C2>=0.8),"Pass","Fail")` -> displays Pass |
| 3 | Ben | 55 | 0.85 | `=IF(AND(B3>=60,C3>=0.8),"Pass","Fail")` -> displays Fail |
| 4 | Cara | 62 | 0.75 | `=IF(AND(B4>=60,C4>=0.8),"Pass","Fail")` -> displays Fail |
| 5 | Dan | 90 | 0.95 | `=IF(AND(B5>=60,C5>=0.8),"Pass","Fail")` -> displays Pass |
| 6 | Eli | 60 | 0.8 | `=IF(AND(B6>=60,C6>=0.8),"Pass","Fail")` -> displays Pass |
| 7 | Fay | 45 | 0.9 | `=IF(AND(B7>=60,C7>=0.8),"Pass","Fail")` -> displays Fail |

Each row tests the same two thresholds against that row's own values. Ana clears both, so she passes. Ben fails on score alone. Cara fails on attendance alone. Dan clears both comfortably. Eli sits exactly on both thresholds, and because the operators are `>=`, both conditions are true and he passes. Fay has strong attendance but a score below 60, so she fails.

The boundary rows are the ones worth studying. Eli's result shows that `>=` includes the threshold value itself. If you changed the operators to `>`, Eli would fail on both counts. Choosing the right operator is often the difference between a correct rule and a subtly wrong one.

## Other Ways to Do It

The IF AND pattern is not the only route. If you have several possible outcomes rather than a simple pass or fail, the [IFS function in Excel](/blog/data-analysis/ifs-function-excel) lets you list conditions and results in pairs without nesting.

If your logic is "either condition is enough" instead of "both must hold", you want OR instead of AND. The guide to [combining IF and OR](/blog/data-analysis/excel-if-or-combine-functions) covers that pattern.

For rules with more than two outcomes stacked inside a single IF, see [nested IF statements in Excel](/blog/data-analysis/nested-if-statements-excel). Nesting gets hard to read past three or four levels, which is why IFS exists.

If you are counting how many rows meet several conditions rather than flagging each row, [SUMIF and SUMIFS](/blog/data-analysis/excel-sumif-sumifs-syntax-examples) is the better tool. It aggregates instead of labeling.

The same logic works outside Excel. The [Google Sheets IF function](/blog/data-analysis/google-sheets-if-function) uses identical syntax, so a formula you build in one usually pastes into the other.

## Troubleshooting

If a row passes when it should fail, one of the tested cells may hold a number stored as text. Excel ranks any text above any number in a comparison, so a test like `B2>=60` returns TRUE for text. Check that the cells you are testing hold real numbers.

If every row returns the same result, you probably locked the references. A formula with `$B$2` always points at row 2 no matter where you copy it. Remove the dollar signs if you want each row to test its own values.

If the formula returns `#NAME?`, check the spelling of AND and IF and confirm each function has its closing parenthesis.

If a result looks wrong at the boundary, check your operators. `>=` includes the threshold, `>` excludes it.

If you see `FALSE` instead of your text, you left out the value_if_false argument, so IF returns FALSE when the test fails. Supply both the true result and the false result.

## Common Mistakes

- **Using AND outside IF.** `=AND(B2>=60,C2>=0.8)` returns TRUE or FALSE, not "Pass" or "Fail". Wrap it in IF to control the output.
- **Forgetting quotation marks around text results.** `"Pass"` works, `Pass` alone gives an error. Numbers and cell references do not need quotes.
- **Mismatched parentheses.** Every opening bracket needs a closing one. Count them if the formula will not accept.
- **Mixing up AND and OR.** AND requires all conditions to be true. OR requires at least one. Pick the one that matches your rule.
- **Hardcoding values you may need to change.** Put thresholds in their own cells and reference them, so you can update the rule without editing every formula.
- **Testing the wrong row.** When you copy down, confirm the first row's references shifted as expected before filling the rest of the column.

## Limitations

IF AND returns exactly two outcomes. If your rule has three or more possible results, you need nesting or the IFS function. Stacking IF AND formulas inside each other works but becomes difficult to read and audit once you pass two or three levels.

AND treats every condition as equally important. There is no way to say one condition matters more than another, and no way to return partial credit. If your rule needs weighting or scoring, build that in a separate column first and test the score.

The function also cannot handle ranges as conditions in the way SUMIFS can. AND expects individual logical tests, not a range to scan. For row-by-row flagging that is fine. For aggregate questions about a whole column, use a different function.

## Frequently Asked Questions

### Can I use more than two conditions in an IF AND formula?

Yes. Add each condition inside AND, separated by commas. `=IF(AND(B2>=60,C2>=0.8,D2="Yes"),"Pass","Fail")` tests three conditions. All three must be true for the formula to return "Pass".

### What is the difference between IF AND and IF OR?

AND requires every condition to be true. OR requires at least one. If your rule is "score is high and attendance is high", use AND. If it is "score is high or attendance is high", use OR.

### Why does my IF AND formula return FALSE instead of my text?

You likely used AND on its own without wrapping it in IF. The AND function only returns TRUE or FALSE. Put it inside IF as the logical test and supply the two result values.

### Can I return a number instead of text?

Yes. Replace `"Pass"` and `"Fail"` with numbers, such as `=IF(AND(B2>=60,C2>=0.8),1,0)`. Leave off the quotation marks for numbers. You can also return a cell reference or a calculation.

### Does IF AND work the same in Google Sheets?

Yes. The syntax is identical, and the same formula works in both programs. If you move a sheet between them, IF AND formulas usually transfer without changes.

## References

1. [Altman DG, Bland JM (2011). Brackets (parentheses) in formulas. BMJ](https://doi.org/10.1136/bmj.d570)

## Further Reading

- [Broman KW, Woo KH (2018). Data Organization in Spreadsheets. The American Statistician](https://doi.org/10.1080/00031305.2017.1375989)
- [Ziemann M, Eren Y, El-Osta A (2016). Gene name errors are widespread in the scientific literature. Genome Biology](https://doi.org/10.1186/s13059-016-1044-7)
- [Microsoft Support: Excel help and learning](https://support.microsoft.com/en-us/excel)
- [McCullough B, Heiser DA (2008). On the accuracy of statistical procedures in Microsoft Excel 2007. Computational Statistics &amp; Data Analysis](https://doi.org/10.1016/j.csda.2008.03.004)
- [Abeysooriya M, Soria M, Kasu MS et al. (2021). Gene name errors: Lessons not learned. PLOS Computational Biology](https://doi.org/10.1371/journal.pcbi.1008984)

## Related Articles

- [IFS Function in Excel: Syntax and Examples](/blog/data-analysis/ifs-function-excel)
- [Excel RIGHT Function: Syntax, Examples and Uses](/blog/data-analysis/excel-right-function)
- [Excel SUMIF and SUMIFS: Syntax and Examples](/blog/data-analysis/excel-sumif-sumifs-syntax-examples)
- [Excel IF OR: How to Combine IF and OR Functions](/blog/data-analysis/excel-if-or-combine-functions)
- [Nested IF Statements in Excel: Multiple Conditions](/blog/data-analysis/nested-if-statements-excel)
- [Statistical Symbols and Notation: A Quick Reference](/blog/guides/statistical-symbols-and-notation-a-quick-reference)
- [If-Then Hypothesis Templates for Biology](/blog/research-skills/if-then-hypothesis-templates-for-biology-20-ready-to-use-structures-for-your-next-experiment)
- [Tabular Data: What It Is and How to Analyze It](/blog/research-skills/tabular-data-what-it-is-and-how-to-analyze-it)