IF function

Category: Logical
Introduced: Excel 2003

Summary

Specifies a logical test to perform

Syntax

IF(C2=”Yes”,1,2)

Example

=IF(C2=”Yes”,1,2)
= Yes, then return a 1, otherwise return a 2)
=IF(C2=1,”Yes”,”No”)
= 1, then return Yes, otherwise return No)As you see, the IF function can be used to evaluate both text and values. It can also be used to evaluate errors. You are not limited to only checking if one thing is equal to another and returning a single result, you can also use mathematical operators and perform additional calculations depending on your criteria. You can also nest multiple IF functions together in order to perform multiple comparisons.
=IF(C2>B2,”Over Budget”,”Within Budget”)
=IF(C2>B2,C2-B2,0)
=IF(E7=”Yes”,F5*0.0825,0)
= “Yes”, then calculate the Total Amount in F5 * 8.25%, otherwise no Sales Tax is due so return 0)

Microsoft Support Page

https://support.microsoft.com/en-us/office/if-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2

Back to Functions