
How to Use the IF Function in Excel
How to Use the IF Function in Excel
The IF function is one of the most powerful and versatile functions in Excel. It lets your spreadsheet make decisions: if a condition is true, do one thing; if it is false, do something else. Once you understand IF, you unlock a whole category of smarter, more dynamic spreadsheets.
IF Syntax
The IF function takes three arguments: =IF(logical_test, value_if_true, value_if_false)
- logical_test: A condition that evaluates to TRUE or FALSE (e.g., A1 greater than 100, B2 equals Paid)
- value_if_true: What to return or do when the condition is TRUE
- value_if_false: What to return or do when the condition is FALSE
A Simple Example
Suppose column A contains sales figures and you want column B to show Pass if sales exceed 1000, and Fail otherwise. In cell B1: =IF(A1 is greater than 1000, Pass, Fail). If A1 contains 1200, B1 shows Pass. If A1 contains 800, B1 shows Fail.
Using IF with Numbers
IF can return numbers instead of text. For a commission calculation where the rate is 10% for sales over 5000 and 5% otherwise: =IF(A1 is greater than 5000, A1 multiplied by 0.1, A1 multiplied by 0.05). The formula returns the correct commission amount based on the sales figure.
Nested IF for Multiple Conditions
To test more than two outcomes, nest IF functions inside each other. For a grading system: =IF(A1 is at least 90, A, IF(A1 is at least 80, B, IF(A1 is at least 70, C, F))). Excel evaluates each condition in order and returns the first match found.
IFS Function (Multiple Conditions Made Easier)
In newer versions of Excel, the IFS function replaces nested IF with a cleaner syntax. Instead of nesting, you list condition-result pairs: =IFS(A1 is at least 90, A, A1 is at least 80, B, A1 is at least 70, C, TRUE, F). The TRUE at the end acts as a catch-all default.
Combining IF with Other Functions
IF becomes even more powerful combined with AND, OR, NOT, and other functions. =IF(AND(A1 greater than 0, B1 equals Active), Eligible, Not Eligible) requires both conditions to be true before returning Eligible. This is the foundation of complex business logic in Excel.