Excel IF Formula Examples for Everyday Spreadsheet Tasks

Formulas & functions · Updated November 3, 2026

Excel IF Formula Examples for Everyday Spreadsheet Tasks

Excel’s IF formula checks whether a condition is true and returns one result if it is, and another if it is not. For example, with scores in B2:B20, enter =IF(B2>=70,"Pass","Review") in C2 to display Pass for a score of 70 or higher and Review otherwise; copy it down to apply the same test to other rows.

The IF function is useful for turning a comparison into a readable result, such as a status, category, or calculation. The examples below use Microsoft Excel for Microsoft 365 on Windows and explain the cell layout and expected result for each formula, so you can adapt them without guessing at the references.

How the IF Function Works

IF has three parts: a condition to test, the result to return when that condition is true, and the result to return when it is false. The condition is called a logical test. It commonly compares a cell with a number, text, date, or another cell.

For example, the condition B2>=70 asks whether the value in B2 is at least 70. The comparison operators you will most often use are:

  • = means equal to.
  • > means greater than, and < means less than.
  • >= means greater than or equal to, and <= means less than or equal to.
  • <> means not equal to.

Text values in formulas need straight double quotation marks, as in "Pass". Cell references and numbers do not need quotation marks. Excel formulas use commas to separate arguments in the examples here; some regional settings use semicolons instead. If Excel rejects a formula with commas, your system’s list-separator setting may be the reason.

Basic IF Formula Examples

A common use is checking whether a value meets a threshold. Suppose a worksheet records a test score in column B, starting at B2. With the score in B2 and the formula entered in C2, =IF(B2>=70,"Pass","Review") returns Pass for 70, 85, or 100, and Review for 69 or any lower score. The boundary is inclusive because the comparison uses greater than or equal to.

IF can also return a number or perform a calculation instead of displaying text. Imagine column B contains units sold and column C contains a per-unit bonus rate. With units sold in B2 and the rate in C2, =IF(B2>=10,C2*B2,0) returns the total bonus when at least 10 units were sold and zero otherwise. If B2 is 12 and C2 is 3, the result is 36. Check that the condition and the calculation reflect the real rules you intend to apply.

You can compare two cells, too. With actual sales in B2 and a target in C2, =IF(B2>=C2,"Target met","Below target") in D2 reports whether sales reached the target. This is useful when targets vary by row, because each row can compare its own actual and target values.

Handling Blank Cells

A blank-input check can keep a worksheet from showing distracting zeroes or messages before someone has entered data. Suppose quantity is in B2 and unit price is in C2. With those cells as the inputs, =IF(B2="","",B2*C2) returns a blank-looking result when B2 is blank; otherwise it multiplies quantity by price. For a quantity of 4 and a price of 2.50, it returns 10.

There is an important distinction: the formula returns an empty text string when B2 is blank, not a genuinely empty cell. The formula cell still contains a formula, so some counts, charts, or other formulas may treat it differently from a truly empty cell. If both quantity and price must be present, use a condition that checks both inputs. With quantity in B2 and price in C2, =IF(OR(B2="",C2=""),"",B2*C2) stays blank if either input is missing and calculates the product only when both have entries.

Be careful when checking whether a cell is blank if the cell might contain a formula that itself returns an empty string. A comparison to an empty string can also match that displayed-empty result. If the distinction between a physically empty cell and a formula returning empty text matters to your workbook, test the exact situation with a small sample before building further logic on it.

Combining Conditions with AND and OR

Use AND inside IF when every condition must be true. For instance, suppose a person qualifies only if their score is at least 50 and their consent field says Yes. With the score in B2 and consent in C2, =IF(AND(B2>=50,C2="Yes"),"Eligible","Not eligible") returns Eligible only when both tests pass. A score of 60 with No consent returns Not eligible.

Use OR when at least one of several conditions is enough. Imagine a service ticket should be followed up if its priority is Urgent or its due date has passed. With priority in B2 and due date in C2, =IF(OR(B2="Urgent",C2<TODAY()),"Follow up","Routine") returns Follow up when either test is true. TODAY returns the current date, so the result can change as the calendar date changes. A due date equal to today is not earlier than today; change the comparison to less than or equal to if today should count as overdue.

AND and OR can each test more than two conditions. Keep the logic readable by grouping related tests, and check edge cases such as a missing date or a different spelling in a text field. Comparisons of text may be affected by spaces or inconsistent entries, so controlled lists or data validation can help keep inputs consistent.

Nested IF for More Than Two Outcomes

A nested IF places another IF in the result portion of the first one. This lets a formula assign multiple categories in order. Suppose test scores are in B2, and the grading rules are 90 or above for A, 80–89 for B, 70–79 for C, and below 70 for Needs review. With the score in B2, =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","Needs review"))) returns B for a score of 84 and C for 70.

The order matters: Excel checks the first condition, then moves to the next only when the earlier one is false. Starting with the highest threshold in this example prevents a score of 95 from being classified as B or C. Test the exact boundary values—69, 70, 79, 80, 89, and 90—to confirm the categories match the intended rules.

Long chains of nested IFs can be difficult to read and maintain. For a simple grading table, Excel’s IFS function can be an alternative, but it is not necessary for the examples above. For a changing set of categories or thresholds, a separate lookup table may be easier to update than editing a long formula. Choose the approach that makes the rules clear to the next person who must maintain the workbook.

Choosing Between IF, IFS, and IFERROR

IF is the best fit for a yes-or-no test with two possible outcomes. Nested IF can handle several outcomes, while IFS can make a series of condition-and-result pairs easier to scan. IFS is available in Microsoft 365 and newer Excel versions, but IF works in older versions as well. If a workbook will be opened in older software, confirm that every function it uses is supported there.

IFERROR solves a different problem: it returns a chosen result when an expression produces an error. It does not decide whether a business condition is true. For example, if revenue is in C2 and units are in B2, a division may fail when B2 is zero. With those values in B2 and C2, =IFERROR(C2/B2,"Check inputs") returns the quotient when it can calculate one and Check inputs when the expression produces an error. If C2 is 120 and B2 is 10, it returns 12.

Use IFERROR thoughtfully. It can make a report cleaner, but a broad fallback can also hide unexpected problems in source data or in the formula itself. If you specifically want to handle a zero denominator, an IF test can make that rule explicit. With units in B2 and revenue in C2, =IF(B2=0,"No units",C2/B2) displays No units when B2 is zero and otherwise calculates revenue per unit. Decide whether zero, blank, and invalid input should have different outcomes.

Common IF Formula Problems

  • Wrong comparison boundary: > excludes a value exactly equal to the threshold; >= includes it. Check what should happen at the cutoff.
  • Missing quotation marks around text: Text results such as Pass need straight double quotation marks. Without them, Excel may treat the word as a name and return an error.
  • Extra spaces or inconsistent text: The entries Yes and Yes followed by a space may not behave as expected in exact comparisons. Check the underlying cell contents if a condition appears false unexpectedly.
  • Incorrect parentheses: Each opening parenthesis needs a matching closing parenthesis. In nested formulas, count the levels or use Excel’s formula bar to inspect the structure.
  • Copying formulas with the wrong references: B2 changes to B3 when a relative formula is filled down. If a reference must remain fixed, use dollar signs, such as $B$2. For example, a fixed threshold stored in F1 can be compared as B2>=$F$1.
  • Unexpected date results: Excel stores dates as serial numbers, so make sure the input is a real date and the cell is formatted appropriately. TODAY updates over time, which can change date-based IF results.

In Microsoft 365 for Windows, enter a formula in the formula bar or directly in a cell, then press Enter. To fill a formula down, select the formula cell and drag its fill handle, or copy it and paste into the intended range. On Mac, the same formulas and ribbon concepts generally apply, though keyboard shortcuts and some interface details differ. Excel for the web also supports standard IF formulas, but its interface may differ from the Windows desktop app.

When to Use Conditional Formatting Instead

Not every true-or-false rule needs an IF formula. If the only goal is to make values stand out visually—for example, coloring scores below 70—Conditional Formatting can change a cell’s appearance without adding a status column. In Excel for Microsoft 365 on Windows, select the cells and choose Home > Conditional Formatting, then select a rule type that fits the data.

Use IF when you need a result that another formula can use, a text label to filter, or a calculated value to display. Use Conditional Formatting when the underlying value should remain unchanged and the visual cue is enough. You can use both: an IF formula can create a clear status, while conditional formatting highlights the rows that need attention.

Frequently Asked Questions

What does the IF formula 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, cell values, or the result of another calculation.

How do I write an IF formula with text?
Put text results in straight double quotation marks. For example, with a status value in B2, =IF(B2="Complete","Done","Open") returns Done when B2 contains Complete and Open otherwise.

Can an IF formula check two conditions?
Yes. Put AND inside IF when both conditions must be true, or OR inside IF when either condition is enough. Make sure the conditions match the actual rule you want to apply.

Why does my IF formula show FALSE?
If the third argument is omitted, Excel returns FALSE when the condition is false. Add the result you want for that case, such as a message, zero, or an empty string.

Can IF return a blank cell?
It can return an empty text string, commonly written as "", which looks blank in the worksheet. The formula cell is not truly empty, however, and that distinction can matter to other formulas or reports.

Is IF available in Google Sheets?
Yes, Google Sheets also has an IF function with similar basic behavior. This page’s instructions and examples are written for Excel, so check the Google Sheets documentation if you need details about its interface or regional settings.

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.