# How to write an IF formula with three outcomes in Excel

Nest a second IF in the FALSE branch: =IF(C2>B2,"Over budget",IF(C2<B2,"Under budget","On budget")).

**Excel:** `=IF(C2>B2,"Over budget",IF(C2<B2,"Under budget","On budget"))` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| Dept | Budget | Actual | Status |
| Sales | 50000 | 53200 |  |
| HR | 18000 | 16450 |  |
| IT | 42000 | 42000 |  |
| Ops | 31000 | 29875 |  |
| Legal | 12000 | 12600 |  |

Formula in D2, filled to D6: `=IF(C2>B2,"Over budget",IF(C2<B2,"Under budget","On budget"))`

Result: Over budget; Under budget; On budget; Under budget; Over budget

## How it works

The first IF settles one outcome. Its FALSE branch holds a second IF that separates the other two. When neither test is TRUE the amounts are equal, so the last result needs no test of its own.

## Other ways

- `=IFS(C2>B2,"Over budget",C2<B2,"Under budget",TRUE,"On budget")`: IFS lists the cases without nesting. Excel 2019 and later, and Google Sheets.
- `=SWITCH(SIGN(C2-B2),1,"Over budget",-1,"Under budget","On budget")`: SIGN returns 1, -1 or 0, and SWITCH maps each to a label.

## Common mistakes

- Exact equality is rare with real amounts. Allow a tolerance: `=IF(ABS(C2-B2)B2,"Over budget","Under budget"))`.
- Each IF you open needs its own closing bracket at the end. Count them when Excel reports a problem with the formula.

## Questions

**How do I label numbers as positive, negative or zero?**

`=IF(A2>0,"Positive",IF(A2<0,"Negative","Zero"))`.

**How do I add a fourth outcome?**

Nest another IF in the last FALSE branch, or switch to IFS, which reads better past three outcomes.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/if-formula-with-three-outcomes
