Several examples are outlined.
What is the IF Function?
The IFfunctionin Excel is used to perform a logical test.
Aformulausing this function is also called anIF statementor anif/then statement.
All formulas that use this function can have one of two results.
If its true, one thing happens, but if its false, something else happens.
The IF function is one ofseveral logical functionsyou can use in Excel.
Others include AND, IFERROR, IFS, NOT, and OR.
If the first part is false, then do this other thing instead.
The test is to see ifA2is larger thanA3.
If it is, writeBigger, otherwise writeSmaller.
Do Math If Statement Is True
This IF statement is written a little differently.
Instead of having thevalue_if_trueresult be a word, its subtracting one value from another.
So, ifA2is in fact larger thanA3, the difference will be the result.
If its not true, since weve omitted thevalue_if_falsepart, Excel returnsFALSE.
The IF condition here isA2/A3=5.
If that’s true, then we do the calculationA2/A3.
If its not equal to5, we want the result to be nothing, so we use double quotes.
Test If a Date Is Today
Other Excel functions can be used within an IF statement.
In this example, were using the TODAY function to check ifA2is todays date.
If it is, the formula writesThis is today, otherwise nothing is written.
Using AND With IF Formula
This example of the IF function is a bit more involved.
IF(E2<=TODAY(),“Now”,“Soon”)is in theUrgencycolumn.
The second IF statement is still structured like an IF statement even though AND is being used in it.
The formula checks forFandMinB2and then writes eitherClass AorClass Bdepending on the statement that’s true.
In our example, IF is written twice, so we need two parentheses at the end.
Three IF Statements in One Formula
Heres an example of a formula with multiple IF statements.
Put the cursor after the equals sign and pressAlt+Enter(Windows) orCtrl+Option+Enter(Mac).
This puts the rest of the formula on a new line.
Repeat Step 3 before each IF statement so that every instance is put on its own line.