What the IF function does
The IF function is one of Excel’s most useful and most used functions. What it does, basically, is test to see whether a certain condition is true or false. If the condition is true, the function will do one thing, if the condition is false, the function will do something else.
The basic form or syntax of the function is:
=IF(logic test, value if true, value if false)
The logic test is always a comparison between two values. Comparison operators are used, for example, to see if the first value is greater than or less than the second, or equal to it.
While the logic test section is limited to answering a true or false question, you have greater flexibility in what you place in the last two arguments.
Leaving Cells Blank
Having an IF function return a blank cell is similar to having it return words or a text statement. You use quotation marks as with text, but just don’t put anything between them.
=IF(A5 > 5000,”Too High”,” ”)
In this example, the IF function acts as a flag. If the value in cell A5 goes above 5,000, the warning “Too High” is displayed in the cell. If A5 is not above 5,000, there is no need for a warning so the cell remains blank.
Note: there is no comma separator in 5,000 in the above example. This is because the IF function uses the comma to separate the three sections of the IF function contained within the round brackets.
If you use a comma as a separator in numbers greater than a thousand, Excel will give you an error message saying you have too many arguments in your function.
Related Tutorials on the IF Function: