Knowledge base / Excel
IF in Excel: thresholds, numeric results and missing data
I explain condition boundaries, numeric results versus text labels, and the difference between empty cells and empty strings.

IF chooses a result according to a condition: one outcome for true and another for false. I use it for small classifications and calculations, but first write the rule in words. “Pass at 50 points” differs from “pass above 50”. That small distinction determines the result exactly on the boundary, which is why I start the example there.
Syntax and a clear rule
Microsoft describes IF as returning one of two outcomes. I write both outcomes explicitly, including when they are short labels. The basic function is available in versions listed by Microsoft, including Microsoft 365 and Excel 2024, 2021, 2019 and 2016.
=IF(logical_test,value_if_true,value_if_false)
I use English function names and commas. Argument separators depend on regional settings, and some installations require semicolons. Text results use straight quotation marks, while numeric results are written without quotes. IF returns a value in its own cell. It does not move a record to another sheet or apply a cell colour by itself.
A threshold of 50 includes the boundary
Suppose A2 contains a numeric score from a synthetic dataset. The exercise rule says that at least 50 points means a pass, so I use >=. A score of 49 returns “Fail”, while 50 and 51 return “Pass”. The condition remains unchanged; only its input differs.
=IF(A2>=50,"Pass","Fail")
This comparison assumes valid numeric input. It is not a complete score-validation rule. If the permitted range is 0 to 100, a score of 150, text and missing data need separate treatment. A “Pass” label does not establish that the source was valid. I distinguish validation from classification so the reader knows which task a particular formula actually performs.
Equality comparisons use a single =, and inequality uses <>. Double == is not Excel’s comparison operator. Microsoft’s operator reference also distinguishes the equal sign starting a formula from the comparison operator within it. The latter compares values; it is not an assignment to a variable.
Return a numeric percentage
For another synthetic example, D2 contains a nonnegative numeric order amount. The invented rule is a 20% discount at 1000 or more, 10% from 500 to below 1000, and 5% below 500. These thresholds are for learning and do not represent KajoData’s commercial offer.
=IF(D2>=1000,20%,IF(D2>=500,10%,5%))
For 1000, the first condition is true, giving 20%. For 500, the first is false and the second is true, giving 10%. For 300, both are false, giving 5%. Order matters: starting with the lower threshold could also capture 1000 before the higher condition is considered. I explain that sequence rather than treating nesting as a trick involving extra parentheses.
If the discount formula is in E2, =D2*E2 gives the discount amount for these valid inputs. With D2 equal to 1000 and E2 equal to 20%, it gives 200. Quoted "20%" would return text. I return a number directly rather than making the next calculation depend on implicit text conversion. Similarly, a numeric grade should be written as 5 if it will participate in calculations, rather than being supplied only as a text label.

An empty cell differs from empty text
When I want to detect a genuinely empty A2 first, I use ISBLANK. Microsoft demonstrates combining it with IF. Its Polish name is CZY.PUSTA.
=IF(ISBLANK(A2),"No data","Data entered")
A cell containing a formula that returns "" still contains a formula, so ISBLANK does not classify it as empty. By contrast, A2="" can include an empty cell and empty text. I choose the check according to what the data mean. “Nothing is visible” is not a sufficient description of a cell’s contents, particularly when the source is produced by other formulas.
If IF itself returns "", its result cell does not become physically empty either. The IS-function reference defines ISBLANK in terms of an empty cell. The distinction affects later missing-data counts. I preserve it in the explanation even when the two cases look identical on screen. A convenient appearance should not quietly change the data definition.
Combine conditions and keep multiple branches readable
AND creates a condition requiring all criteria to hold. Suppose A2 and B2 contain valid numeric results for two tests, and both must be at least 50. The following formula returns “Fail” for 60 and 40. Passing the threshold in one column does not satisfy the complete rule.
=IF(AND(A2>=50,B2>=50),"Pass","Fail")
For more branches, I consider IFS, available in Microsoft 365 and Excel 2019 and later listed editions. It returns the result associated with the first true condition. A list of equal-value codes may suit SWITCH. A large, frequently changing threshold schedule may be easier to maintain as a separate table with an appropriate lookup.
OFFSET is not a general replacement for multiple conditions. I do not recommend it as a universal solution to a long IF expression. First establish whether rules overlap, their intended order and the treatment of unmatched cases. A shorter expression cannot repair an ambiguous rule. The author should be able to explain the decision process without pointing to the parentheses. That explanation also makes later changes easier to review.
Exercise: explain the boundary cases
For the pass threshold, prepare 49, 50 and 51. For the discount, use 499, 500, 999 and 1000. Write the expected branches before entering a formula. Consider missing values and text separately because the numeric examples do not validate them. Explain why threshold order matters. Then continue with the AND entry and distinguish building a logical condition from selecting the value that the final formula returns.
Key takeaways
Does 50 satisfy A2>=50?
Yes. The operator means greater than or equal to. A2>50 would exclude the boundary value 50.
Should a 20% discount be quoted?
Return numeric 20% without quotes when it will be used in calculations. Quoted text is a different result type.
Does a formula returning an empty string create an empty cell?
No. The cell still contains a formula, so ISBLANK returns FALSE for it.
AI was used in an automated way while working on this article. If you want to learn how to do it too, check out this project.
