In Google Sheets, the IF function checks whether a condition is true and returns one value if it is, and another value if it is false. For example, with a score in A2, =IF(A2>=70,"Pass","Try again") displays Pass for a score of 70 or higher and Try again otherwise.
What the IF function does
IF is a logical function: it lets a spreadsheet choose between two outcomes based on a test. The test can compare numbers, text, dates, or logical values. This makes IF useful for translating raw data into labels or decisions, such as marking an invoice as paid, identifying whether a target was reached, or showing whether a date is overdue.
IF does not change the value being tested. It returns the result you specify, which may be text, a number, a date, a cell reference, or another formula’s result. If the test is true, Sheets returns the second argument; if false, it returns the third. Both outcomes should be supplied when you want predictable results.
The test itself evaluates to a logical TRUE or FALSE. For example, a comparison such as whether a score is at least 70 is true when that condition is met. A cell containing the word “TRUE” as text is not necessarily the same thing as the logical value TRUE; that difference matters when a sheet relies on checkboxes or other logical tests.
Basic syntax and a first example
IF takes three arguments in order: a condition to test, the result to return when the condition is true, and the result to return when it is false. In Google Sheets, type the function into a cell, begin with an equals sign, and separate the arguments with commas in the usual US-style locale.
With a student’s score in A2, this formula returns Pass when the score is 70 or higher and Try again for a lower score: =IF(A2>=70,"Pass","Try again"). If A2 contains 82, the result is Pass. If A2 contains 64, the result is Try again. The comparison operator >= means “greater than or equal to.”
Other common comparison operators include = for equal to, <> for not equal to, > for greater than, and < for less than. Text values in formulas need straight double quotation marks. Cell references and numbers do not: the formula refers to A2 directly, while the words Pass and Try again are quoted text.
To enter the formula, select the result cell, type it in the formula bar or directly into the cell, then press Enter. To apply it to more rows, use the fill handle at the bottom-right corner of the selected cell and drag down, or copy and paste the formula. A relative reference such as A2 changes to A3 and A4 as it is filled down, so each row evaluates its own score.
Using TRUE, FALSE, and checkboxes
TRUE and FALSE are Boolean values, not ordinary words. A checkbox in Google Sheets uses TRUE when checked and FALSE when unchecked by default. To add one, select the relevant cells and choose Insert > Checkbox. You can then use IF to turn a checked state into a readable label.
With a checkbox in A2, this returns Confirmed when it is checked and Pending when it is not: =IF(A2,"Confirmed","Pending"). The condition is simply the value in A2 itself. A checked box evaluates as TRUE, and an unchecked box as FALSE. If you configure custom checkbox values, make sure the test in your formula matches those values rather than assuming the defaults.
You can also test a logical value explicitly. If A2 contains a Boolean value, =IF(A2=TRUE,"Yes","No") returns Yes when A2 is TRUE. In many sheets that explicit comparison is unnecessary, because IF can test A2 directly. By contrast, if A2 contains the text “TRUE,” a text comparison may be needed; check whether the cell is a checkbox, a formula result, or manually entered text before troubleshooting.
Testing more than one condition
A basic IF handles one test. To require multiple conditions at once, combine tests with AND inside IF. AND is true only when every condition supplied to it is true. With a payment status in A2 and an amount in B2, this formula returns Review only when the status is Paid and the amount is at least 100: =IF(AND(A2="Paid",B2>=100),"Review","Standard"). If A2 says Paid and B2 is 125, the result is Review; if either test fails, it is Standard.
Use OR when any one of several conditions should be enough. With a status in A2 and an amount in B2, the formula below returns Check if the status is Late or the amount exceeds 500; otherwise it returns OK: =IF(OR(A2="Late",B2>500),"Check","OK"). For example, A2 equal to Current and B2 equal to 620 produces Check because the amount condition is true.
These functions make the decision rule easier to read than stacking separate IF functions. They are also useful for checks such as “approved and signed” or “urgent or past due.” Before building a long condition, write down the rule in ordinary language and verify whether it means all conditions must be met (AND) or at least one must be met (OR).
Returning blank cells and handling missing data
Sheets users often want a formula cell to appear empty until input is available. With an optional value in A2, this formula displays a blank-looking result when A2 is empty and otherwise multiplies the input by 1.1: =IF(A2="","",A2*1.1). If A2 is empty, the returned value is an empty text string; if A2 contains 100, the result is 110.
An empty string is not exactly the same as a truly empty cell. The formula cell still contains a formula, and other functions may treat its result differently from an untouched blank. This distinction can affect counts, charts, filters, and later tests. If the difference matters, decide whether you need an empty display or a genuinely unused cell; a formula cannot make its own cell physically empty.
Consider whether zero is meaningful before treating it like missing data. A zero balance, zero score, or zero quantity may be a valid answer, while an empty cell may mean “not entered yet.” A formula that tests whether a cell equals zero can therefore produce misleading labels if blank inputs are possible. A separate blank check, as in the example above, helps keep those cases distinct.
Nested IFs and clearer alternatives
You can put another IF in the true or false result to choose among more than two outcomes. With a score in A2, this formula labels scores as A, B, C, or Needs improvement: =IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","Needs improvement"))). A score of 85 returns B; a score of 68 returns Needs improvement. The conditions are checked from left to right, so their order is important.
Nested formulas can become difficult to maintain when there are many categories. Make thresholds mutually sensible and test boundary values such as 69, 70, 79, 80, and 90. A missing score can also fall through to the final outcome, so add a blank check if that should not be treated as a failing grade.
For several fixed categories, consider whether a lookup table would be easier to update than a long nested formula. Put the thresholds and matching labels in a small, clearly labeled table, then use a lookup approach appropriate to the data. For a short decision with only two outcomes, IF is usually simpler; for many rules that change over time, a separate table can make revisions less error-prone.
Common errors and troubleshooting
A formula parse error often comes from missing parentheses, a missing argument, or quotation marks that are not straight double quotes. Check that the opening IF parenthesis has a matching closing parenthesis and that text results are surrounded by quotation marks. When copying a formula from a document, retype unusual quotation marks if Sheets does not recognize them.
- Wrong separator: Google Sheets commonly uses commas between arguments, but spreadsheet locale settings can require semicolons. Check File > Settings > Locale if a formula using commas produces a parse error, and use the separator expected by that sheet.
- Numbers stored as text: A value that looks numeric may be text, especially after importing data. Comparisons or arithmetic may then behave unexpectedly. Check the source data and its formatting rather than changing the IF test blindly.
- Unexpected capitalization or spaces: Text imported from another source may contain extra spaces or inconsistent spelling. “Paid” and “Paid ” can fail to match as expected. Clean or standardize the source values when possible.
- Boundary mistakes: Decide whether a threshold includes its endpoint. Use >= for “at least 70,” but > for “more than 70.” Test values exactly on the threshold.
- Blank cells treated as zero: Numeric comparisons may not distinguish an unentered value from a meaningful zero in the way a reader expects. Add a deliberate blank test when those cases need different results.
Google Sheets IF compared with Excel
The basic IF function works in both Google Sheets and Microsoft Excel, and formulas such as =IF(A2>=70,"Pass","Try again") are familiar in both programs. The core logic and three-argument structure are the same, so a simple IF formula can generally be moved between them without redesign.
Differences are more likely to come from settings, surrounding features, or collaboration workflows than from IF itself. Argument separators can depend on locale in either spreadsheet program. Google Sheets is browser-based and saves changes to a Google account’s files, while Excel has desktop and web editions and works with Microsoft file formats. When sharing a workbook or copying formulas, check locale, data types, and any functions beyond basic IF for compatibility.
Google Sheets also offers conditional formatting when the goal is only to change how a cell looks, rather than return a result from a formula. Select the range and choose Format > Conditional formatting to create a visual rule, such as coloring scores below 70. Use IF when you need an actual value like Pass or Try again in a cell; use conditional formatting when the data should remain unchanged and only its appearance needs to signal a condition.
Frequently Asked Questions
What does IF TRUE mean in Google Sheets?
If the condition supplied to IF evaluates to TRUE, Sheets returns the function’s second argument, called the value-if-true result. For a checked checkbox, that could be a label such as Confirmed.
How do I write an IF formula with text?
Put text results in straight double quotation marks and separate the arguments with the correct delimiter for the sheet’s locale. For example, with a score in A2: =IF(A2>=70,"Pass","Fail").
Can IF return a blank in Google Sheets?
Yes. Use an empty string as the result for the condition you want to hide. The cell will look blank, but it still contains the formula and is not the same as a completely empty cell.
Why does my IF formula show a parse error?
Check the parentheses, argument separators, quotation marks, and spelling of the function. If commas fail, the sheet’s locale may require semicolons; File > Settings > Locale shows the locale setting.
Can I use multiple IF conditions?
Yes. Combine tests with AND when all conditions must be true, or OR when any one condition is sufficient. For many possible outcomes, nested IFs work, but a lookup table may be easier to maintain.
Related
- How to Keep Track of Your Budget in Excel: Step by Step
- Wrap Text in Excel: Keep Long Cell Entries Visible
- How to Keep Track of Expenses in Excel
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 Clear the Offline Cache in OutlookTo clear Outlook’s offline cache in classic Outlook for Windows, close Outlook, find the account’s .ost file, and…
- Install Solver in Excel: A Step-by-Step Setup GuideTo install Solver in Excel for Microsoft 365 on Windows, open File > Options > Add-ins, choose Excel…
- How to Add a Bottom Header in Microsoft Word EasilyTo put text at the bottom of a page in Word, add a footer: choose Insert > Footer,…
- Clean Excel Sheet: Remove Gridlines and BordersTo clean up an Excel sheet with no cell lines, open the worksheet and choose View > Show…
- How to Export Xfinity Contacts to Outlook: Full GuideTo move your Xfinity address book into Outlook, export your contacts from Xfinity Email as a CSV file,…
- How to Change Font Size in Outlook Email ViewTo make messages easier to read in Outlook, adjust the reading-pane zoom in classic Outlook for Windows, or…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.