How do we use the formula in Excel

Office Use the IF function in Excel - that's how it works


With the IF function in Excel you have a formula for calculating logical comparisons between current and expected values. Two different results can be displayed depending on the conditions previously set. Either the comparison is TRUE or FALSE. The function is therefore well suited as an intermediate step for checking content in order to avoid undesired errors. We'll show you how the function is structured and use examples to explain how it works.

Read more about more tips about controls and formulas in Excel here.

Structure of the function

Depending on whether the checked condition is met or not, a correspondingly different value also comes out. The notation of the formula in Excel (also called syntax) is composed as follows:

  • If the CONDITION is met (true), THEN (value)
  • If the CONDITION is NOT fulfilled (false), ELSE (value)

The arguments of the function are listed individually:

Danger: Make sure to separate the individual values ​​of the formula with a semicolon.


If we take the example from the overview table, the formula should be as follows:

The condition to be checked here is the "Traffic light color". The output value is the action resulting from the comparison. If now"red" in Cell B3 entered, appears in cell C3 "Stand", becomes "other value"entered, appears"Walk".


If you copy the formula into the line below, Excel will automatically check the Cell B4. Since the condition (B4 = "red") has not been fulfilled, the "Else_value"is displayed.

Note: You can use these functions in Excel to evaluate numerical values ​​as well as texts (as you can see in the example above). When marking text content, make sure that quotation marks to put.

Create the "IF" function in Excel

To perform a calculation using the IF function, simply follow our step-by-step instructions.


The IF function in examples

"IF you have earned more than € 1,000, THEN you can spend money. IF you have earned less than € 1,000, THEN you have to save." The corresponding formula should look like this in Excel:


You can also express or expand the results using formulas, as in the following example. "IF an employee receives a bonus, THEN this bonus should be 2% of his salary. IF an employee does not receive a bonus, 0 should be entered". In Excel this calculation would have to be formulated as follows:

Nested IF function

Instead of a single exam, you can too several conditions at the same time and nest in each other. Nesting in this case means that several IF functions are queried one after the other. For this purpose, the second IF function is inserted at the place of the else_value. To illustrate this, we extend the first example shown:


Thanks to the nesting, not only can "red", but also "orangeThe result, expressed in words, is as follows: IF the 1st condition "red" is fulfilled; THEN I will "stand"; if this is not the case, THEN I will, IF the 2nd condition "orange" is fulfilled; "stand"; OTHERWISE I will "drive".

Note: If the functions are nested, make sure they are correct Number of bracketsto avoid error messages.