Excel IF Statements: Examples and How to Use Them

Formulas & functions · Updated November 3, 2026

Excel IF Statements: Examples and How to Use Them

Excel IF statements let you test a condition and return one value when it is true and another when it is false. For example, if a score is in B2, enter =IF(B2>=60,"Pass","Review") to show Pass for a score of 60 or more and Review for a lower score; a score of 72 returns Pass.

The IF function is useful for turning rules into readable labels, decisions, and calculations. The examples below use Excel for Microsoft 365 on Windows, but the formulas also work in Excel for Mac and Excel for the web. Excel’s menus differ slightly between platforms, but you can enter a formula by selecting a cell, typing it in the formula bar or cell, and pressing Enter.

How the IF function works

IF evaluates a logical test, then selects one of two results. Its syntax is IF(logical_test, value_if_true, value_if_false). The first argument must produce a true-or-false result, such as whether a number is at least a threshold or whether a cell contains a particular word. The second argument is returned when that test is true; the third is returned when it is false.

In the opening example, B2>=60 is the test. Excel checks the value in B2 against 60, including 60 itself because the operator is greater than or equal to. The text Pass is the true result, and Review is the false result. Text results need straight double quotation marks; cell references and numbers do not.

The false result is optional, but leaving it out usually makes Excel return FALSE whenever the condition is false. For a clear worksheet, it is generally better to specify what should happen in both cases. IF can return text, a number, a date, a cell reference, or another formula’s result.

Basic number and threshold examples

A common use is to label whether a target has been met. Assume actual sales are in C2 and the target is 1,000 units. This formula returns Target met when sales are at least 1,000, and Below target otherwise:

=IF(C2>=1000,"Target met","Below target")

If C2 contains 1,250, the result is Target met. If C2 contains 900, the result is Below target. Change the comparison operator to match the rule: > means greater than, < means less than, >= means greater than or equal to, <= means less than or equal to, and <> means not equal to.

IF can also choose a numeric result rather than a label. Assume the order quantity is in A2, with a delivery charge of 8 for orders under 50 and no charge for orders of 50 or more. Enter:

=IF(A2<50,8,0)

If A2 is 32, the formula returns 8; if A2 is 50, it returns 0. The boundary matters: changing the test to A2<=50 would make exactly 50 units incur the charge. Check threshold rules carefully when translating a policy into a formula.

IF statements that check text

Use quotation marks around text that is typed directly into a formula. Assume a shipment status appears in D2. To return Complete only when the cell contains the word Delivered, use:

=IF(D2="Delivered","Complete","Check status")

If D2 contains Delivered, the result is Complete; for any other value, including In transit, it is Check status. Excel’s ordinary text comparisons are not case-sensitive, so delivered and Delivered are treated as equivalent here. If the text comes from another cell, refer to that cell instead of putting its address in quotation marks.

Exact text comparisons can be less reliable when imported data contains extra spaces, spelling differences, or variations such as Delivered – signed. If the source values are inconsistent, clean or standardize them before building a rule, or use a lookup or text-cleaning approach suited to the data. An IF test for exact equality does not automatically mean “contains this word.”

Checking for blank cells

A formula can avoid showing a result until a required input has been entered. Assume the quantity is in A2 and the unit price is in B2. This formula leaves the output visually empty if A2 is blank; otherwise, it multiplies quantity by price:

=IF(A2="","",A2*B2)

When A2 is empty, the formula returns an empty text string. When A2 is 3 and B2 is 12, it returns 36. This is useful in templates because it prevents unfinished rows from displaying a zero or an incomplete calculation.

An empty text string is not the same thing as a truly empty cell: the formula cell still contains a formula, and functions that test whether a cell is genuinely blank may treat it differently. Also decide whether a numeric zero should count as missing. A test such as A2=”” is intended to handle blank-looking inputs, but a rule that must distinguish an empty cell from a zero should be designed explicitly rather than treating the two as interchangeable.

Using IF with dates

Excel stores dates as serial numbers, so date comparisons use the same operators as number comparisons. Assume a due date is in E2. To label dates on or after January 1, 2026 as Current and earlier dates as Past due, use:

=IF(E2>=DATE(2026,1,1),"Current","Past due")

If E2 contains February 10, 2026, the result is Current. The DATE function constructs a date from year, month, and day, which avoids ambiguity between regional date formats such as month/day/year and day/month/year. Make sure E2 contains a real Excel date value, not text that merely looks like a date; text dates may not compare as expected.

For deadlines, think about whether the rule includes the deadline day. A test using greater than or equal to treats the date itself as meeting the condition. A test using greater than would not. If cells include times as well as dates, a value on the same calendar day but later in the day may also affect the comparison.

Combining conditions with AND and OR

Sometimes a result depends on more than one test. AND is true only when every condition inside it is true. Assume a trainee’s score is in B2 and attendance percentage is in C2. To qualify only when the score is at least 70 and attendance is at least 80%, use:

=IF(AND(B2>=70,C2>=80),"Qualified","Not qualified")

For a score of 75 and attendance of 85, the formula returns Qualified. A score of 75 with attendance of 79 returns Not qualified, because both requirements must be met. Make sure the values in C2 use the same scale as the test: if attendance is stored as 85%, Excel represents it as 0.85, so the comparison should use 80% rather than 80.

OR is true when at least one condition is true. Assume a request priority is in D2 and the number of days waiting is in E2. To escalate a request if it is marked Urgent or has been waiting more than three days, use:

=IF(OR(D2="Urgent",E2>3),"Escalate","Standard queue")

If D2 is Urgent and E2 is 1, the result is Escalate. The same result appears when D2 is Normal and E2 is 4. This distinction is important: AND means every listed condition must pass, while OR means at least one must pass.

Nested IF and multiple outcomes

A nested IF places one IF inside another to handle several possible outcomes. Assume a numeric score is in B2. To assign A for 90 or above, B for 80–89, C for 70–79, and Needs improvement for anything lower, use:

=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","Needs improvement")))

A score of 84 returns B, and a score of 68 returns Needs improvement. Excel evaluates the tests from left to right and uses the first true result. The descending order is deliberate: after a score fails the 90 test, Excel checks whether it is at least 80, then at least 70. Reordering the thresholds can cause a broad condition to capture values that should have received a more specific result.

For several clear categories, Excel’s IFS function can be easier to read than a chain of nested IF functions. It checks tests in order and returns the result associated with the first true test. IFS is available in Excel 2019 and later, including Microsoft 365. For the same score bands, with the score in B2, use:

=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",B2<70,"Needs improvement")

A score of 84 returns B. Unlike a nested IF with a final fallback, IFS needs a condition that covers the remaining possibilities; if none of its tests is true, it returns an error. Choose nested IF when compatibility with older Excel versions matters, or IFS when the ordered rules are easier to maintain in that form.

Common IF formula problems and how to fix them

When a formula does not return the expected result, check the condition and the data before changing the formula at random. Frequent causes include:

  • Missing quotation marks: typed text such as Pass must be enclosed in straight double quotes. A cell reference such as A2 should not be quoted.
  • Wrong comparison boundary: confirm whether the rule includes the threshold, then use > or >= accordingly.
  • Numbers stored as text: imported values may look numeric but behave like text. Convert or clean the source data if comparisons produce surprising results.
  • Unmatched parentheses: nested functions need a closing parenthesis for each opening one. Excel’s formula bar can help you inspect the structure.
  • Unintended FALSE results: provide a false-result argument when you do not want Excel to display FALSE for cases that fail the test.

In many English-language Excel installations, formulas use commas between arguments, as in the examples here. Depending on regional settings, Excel may expect semicolons instead. If Excel rejects a correctly structured formula, check the argument separator used by your installation rather than changing the logic. The function name and the comparison operators remain the same.

Choosing between IF and other approaches

Use IF when a cell needs to calculate a result based on a condition. For a single rule, an IF formula is usually direct and easy to audit. For a small number of ordered categories, nested IF or IFS may be suitable, but a long chain becomes harder to edit and more vulnerable to mistakes.

If the conditions form a large table of categories and results, consider a lookup table instead of embedding every rule in one formula. A separate table makes the rules visible and easier to update. If the goal is only to change how cells look, use conditional formatting rather than returning labels with IF; conditional formatting changes appearance without replacing the cell’s underlying value. For totals or counts based on criteria, SUMIF, COUNTIF, or their multiple-condition counterparts may be more appropriate than repeating IF formulas across rows.

Before filling a formula down a column, test representative cases: one value below the threshold, one exactly at it, and one above it. Then check empty inputs and unusual source data if those can occur. In Microsoft 365 on Windows, drag the fill handle or copy and paste to apply a formula to neighboring rows; the same formula-entry approach works on Mac and the web. Relative references such as B2 adjust by row when copied, while dollar signs can lock a reference when a fixed threshold is stored in another cell.

Frequently Asked Questions

What does an IF statement do in Excel?
It tests a condition and returns one result when the condition is true and another when it is false. It can return text, numbers, dates, or results from other formulas.

How do I write an IF formula with text?
Put text values typed directly into the formula in straight double quotation marks, and separate the logical test and the two results with commas in standard English-language settings. For example, the text-result pattern is shown in the shipment-status example above.

Can an IF formula check two conditions?
Yes. Put AND inside IF when all conditions must be true, or OR inside IF when any one condition can be true. The trainee qualification and request escalation examples show both patterns.

Why does my IF formula show FALSE?
Most often, the formula does not specify a false-result value. Add the third argument to say what Excel should display when the test is false.

Can IF return a blank cell?
It can return an empty text string, commonly written as two quotation marks with nothing between them. The result looks blank, but the formula cell is not truly empty.

What is the difference between IF and IFS?
IF tests one condition at a time and can be nested for multiple outcomes. IFS evaluates several condition-result pairs in order, which can make multi-category logic easier to read; it is available in Excel 2019 and later.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.