To use an IF in Google Sheets, enter a condition followed by the value to return when it is true and the value to return when it is false. For example, if a score is in B2, =IF(B2>=70,"Pass","Review") displays Pass for a score of 70 or higher and Review otherwise. For several possible conditions, use IFS or combine IF with AND or OR.
What IF formulas do
An IF formula lets a spreadsheet make a decision from the data in its cells. It checks a logical test, such as whether a number meets a threshold or whether a cell contains a particular word, then returns one result if the test is true and another if it is false. That makes IF useful for labels, status columns, eligibility checks, reminders, and simple calculations that depend on a condition.
Google Sheets has the IF function for a two-way choice and the IFS function for checking a sequence of alternatives. Both are entered in a cell, usually beginning with an equals sign, and can refer to other cells. As you copy a formula down a column, relative references such as B2 adjust to B3, B4, and so on.
In a Google Sheets browser session, type the formula into a cell and press Enter, or begin typing it in the formula bar. The formula can also be copied using the fill handle at the bottom-right corner of the selected cell. Check that copied references still point to the intended cells, especially if the formula uses a lookup table or ranges in another part of the sheet.
Writing a basic IF formula
The general pattern is =IF(logical_expression,value_if_true,value_if_false). The first argument is the test; it must resolve to TRUE or FALSE. The second and third arguments are the outputs for those two outcomes. Text outputs need straight double quotation marks, while a number or a cell reference does not.
Assume B2 contains a test score. This formula returns Pass when B2 is 70 or more and Review for lower scores:
=IF(B2>=70,"Pass","Review")
If B2 contains 84, the result is Pass. If it contains 62, the result is Review. The comparison operators you will commonly use are = (equal to), <> (not equal to), >, <, >=, and <=. Put text being tested in quotation marks, as in a condition that checks whether a status cell says Paid.
The third argument is optional. If you leave it out, Sheets returns FALSE when the test is false. For clearer worksheets, it is usually better to specify the result you want rather than rely on that default. A false result can be a word, a number, another calculation, or an empty text value represented by two quotation marks.
Using IFS for multiple outcomes
When a rule has several possible bands, IFS can be easier to read than putting one IF inside another. It takes condition-and-result pairs and checks them from left to right. The first condition that is true determines the result; later conditions are not evaluated for the choice.
Assume a score is in A2 and the bands are A for 90 or more, B for 80 or more, C for 70 or more, and Needs work for anything lower. Put the highest threshold first:
=IFS(A2>=90,"A",A2>=80,"B",A2>=70,"C",TRUE,"Needs work")
If A2 is 84, the formula returns B: the first test is false and the second is true. The final TRUE acts as a catch-all, so the formula has a result if none of the numeric tests match. Without a condition that always catches the remaining cases, IFS can return an error when no condition is true. Ordering matters: if the A2>=70 test came first, a score of 95 would match it and return C before the more specific threshold was checked.
Use IFS when each outcome has its own condition. For a simple yes-or-no choice, ordinary IF is shorter. IFS does not replace careful rule design: write down the ranges first, decide what should happen at boundary values, and make sure the conditions cover the cases you expect.
Combining conditions with AND and OR
Use AND when every part of a rule must be true. For example, an order might qualify for free shipping only if it is at least $50 and its status is Paid. OR is useful when either of multiple conditions is sufficient, such as allowing access for a manager or an administrator.
Assume B2 contains an order total and C2 contains its payment status. This formula labels an order Free shipping only when both requirements are met:
=IF(AND(B2>=50,C2="Paid"),"Free shipping","Standard shipping")
With B2 equal to 62 and C2 equal to Paid, the result is Free shipping. If either the amount is below 50 or the status differs from Paid, the result is Standard shipping. For an either-or test, assume D2 contains a role:
=IF(OR(D2="Manager",D2="Administrator"),"Access","No access")
Google Sheets also permits logical tests using comparisons directly, but AND and OR make multi-part conditions easier to scan. For more complex logic, use parentheses to make the intended grouping clear. For example, a rule such as “paid and either shipped or ready for pickup” has a different meaning from “paid and shipped, or ready for pickup”; grouping prevents that ambiguity.
Useful patterns for everyday sheets
IF formulas become especially useful when applied consistently to a column. These patterns can help with routine tracking, but choose outputs that match how the sheet will be used and understood by other people.
- Show a status: If a due date is before today, a task may be marked Overdue; otherwise it can be marked On track.
- Apply a simple rule: A quantity can trigger a reorder label when it falls below a chosen minimum.
- Return a calculation selectively: A discount or bonus calculation can be shown only when its qualifying condition is met.
- Keep output cells visually quiet: A formula can return an empty text value while its input row is still blank.
Assume A2 is a task due date and B2 is its completion status. The formula below marks an incomplete task overdue when its date is earlier than today:
=IF(AND(A2<TODAY(),B2<>"Done"),"Overdue","Not overdue")
TODAY updates as the sheet recalculates, so the label can change from one day to the next. If your workflow treats a task due today as overdue at a particular time, a date-only comparison may not express that policy; use a clear rule that matches the actual process.
For a blank-row guard, assume A2 is a name or other required input and B2 is the value being classified:
=IF(A2="","",IF(B2>=70,"Pass","Review"))
This avoids displaying Review on rows that have no input in A2. It does not delete the formula or make the cell truly empty: the result is an empty text value. That distinction can matter to other formulas, charts, filters, and counts. Decide which input cell reliably indicates that a row is in use before adding a blank guard.
Choosing between IF, IFS, and alternatives
Choose IF for one true-versus-false decision, such as whether a value is above a target. Choose IFS when you have three or more distinct cases that can be checked in order. A nested IF can express the same sort of branching, but several levels of nesting are harder to review and maintain. If you do use nested IFs, test each boundary and make the parentheses easy to follow.
For a long list of categories or changing rules, a small lookup table may be easier to update than a long formula. For example, keep categories and thresholds in separate columns, then use a lookup function to find the matching rule. This approach separates business rules from the formula, which can reduce editing mistakes when several people maintain the sheet. A lookup is not automatically better, though: for only two or three stable outcomes, a direct IF or IFS may be clearer.
Conditional formatting is another option when the goal is only to change a cell’s appearance, such as highlighting overdue dates. In Google Sheets, open Format > Conditional formatting to create rules. A formula that writes a status into a cell is more useful when the result needs to be sorted, filtered, copied, or included in a report; formatting changes appearance but does not create a new text value.
Excel also has IF, IFS, AND, and OR, so many basic formulas can be transferred between Google Sheets and Excel. The interfaces and some feature details differ, however, and formulas can be affected by locale settings. In some spreadsheet locales, the argument separator is a semicolon rather than a comma. If a formula copied from a tutorial is rejected, check the spreadsheet’s locale and use the separator expected by that file.
Common errors and how to fix them
A formula that looks reasonable can still give an unexpected result. Check the condition, output order, data type, and cell references before rewriting it. These are frequent causes:
- Wrong argument order: IF expects the test first, then the true result, then the false result. Swapping the last two arguments reverses the outcomes.
- Missing quotation marks: Text values such as Paid or Pass need quotation marks. A cell reference such as C2 does not.
- Thresholds in the wrong order: With IFS, an early broad condition may capture values intended for a later, narrower condition.
- No IFS fallback: If all tests are false, IFS can return #N/A. Add a final catch-all condition when every possible input needs an output.
- Numbers stored as text: A value that looks numeric may have been imported or entered as text. Check the source data and its formatting rather than assuming the comparison is numeric.
- Blank is not zero: A genuinely blank cell, a cell containing 0, and a formula returning empty text are not interchangeable in every calculation. Choose the condition that reflects the data you have.
When a formula returns an error, select the cell and inspect the formula bar for a missing parenthesis, misplaced comma, or misspelled reference. Test the logical expression separately in an unused cell if necessary, then remove the temporary test. For a complicated rule, use small test values around each cutoff—for example, 69, 70, and 71—to verify the boundaries instead of checking only an obvious high or low value.
Frequently Asked Questions
How do I write two conditions in one IF in Google Sheets?
Use AND if both conditions must be true, or OR if either one is enough, inside the IF test. For instance, the free-shipping example above requires both a qualifying total and a Paid status. Make sure each condition uses the correct cell and comparison operator.
What is the difference between IF and IFS in Google Sheets?
IF selects between two outcomes based on one test. IFS checks multiple condition-and-result pairs in sequence and returns the result for the first true condition. Add a final catch-all condition if you want a defined result when none of the earlier conditions is true.
Why does my IFS formula show #N/A?
That can happen when none of the conditions in the formula is true. Review the conditions for gaps, then add a final condition that catches remaining inputs if appropriate. Also confirm that the cell contains the kind of value the tests expect, such as a number rather than text that looks like a number.
Can an IF formula return a blank?
Yes. Use an empty text value as the result for the branch that should look blank. The cell still contains a formula and returns text of zero length, so other formulas may treat it differently from a cell that has never contained a value.
Can I use IF formulas in Excel too?
Basic IF, IFS, AND, and OR formulas are available in both Google Sheets and current Excel versions. A formula may need adjustment if the other program uses different locale separators or if it relies on a feature that is not supported there. Check the destination spreadsheet after pasting rather than assuming every workbook behaves identically.
Related
- Signature Line in Word Without the X Placeholder Symbol
- Insert a Square Checkbox in Word: Symbol or Clickable Box
- Insert a Personal Signature in Word for Mac: Steps & Tips
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Set Up Auto Forward in Outlook for MacTo automatically forward every new message from Outlook for Mac, open your mailbox in Outlook on the web,…
- Add a Line Below a Header in Word: Borders and ShapesTo add a line below text in a Word page header, open the header, click in its text…
- Excel Data Model vs Power Query: How They Work TogetherPower Query cleans, reshapes, and imports data; the Excel Data Model stores related tables so you can analyze…
- Excel Data Validation Drop-Down: Create and Edit ListsTo create a drop-down list in Excel for Microsoft 365 on Windows, select the cell or cells, choose…
- How to Make Columns Smaller in Microsoft Word QuicklyTo make page columns narrower in Microsoft Word, click inside the column text, go to Layout > Columns…
- Schedule an Email in Outlook: Step-by-StepTo schedule an email in Outlook, write your message, open the menu beside Send, choose Schedule send (or…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.