Run a logical test and return a value based on the result.
The IF function checks a condition and returns one value if it is true, and another if it is false. Its syntax is =IF(condition, value_if_true, value_if_false). It is one of the most widely used functions in Excel.
If A1 is greater than B1, return A1; otherwise return B1. Place the result in C1.
Click cell C1, type your formula and press Enter.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| Value 1 | Value 2 | Larger Value | |||
| 1 |
11
|
35
|
|||
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 | |||||
| 6 |