Returns one value for a TRUE result, and another for a FALSE result
The IF function is one of Excel's logical functions.
The IF function performs a logical test (that is to say - is something true or false) and then returns the value you have provided if the result is TRUE or the value you have provided if the result is FALSE.
The IF function is one of the most popular functions in Excel.
In financial modelling it is often used to model business logic based on 1, 0 flags.
Let's take a look at a simple example of the IF function.
We would like to check is the value in A1 is the value one. If its is 1 then we would like to return "Yes", if it isn't then we would like to return "No".
The best way to understand the IF function is to replace the first comma with the word “then” and the second comma with the word “Otherwise”:
If the value in cell A1 is equal to 1, then return “Yes”, otherwise return “No”.
Logical test – A question resulting in the answer TRUE or FALSE
Value if true – What to return if the answer to the logical test is TRUE
Value if false – What to return if the answer to the logical test is FALSE
Read more about the IF function on the Microsoft support page here.