Excel: Inserting the If Then function – here’s how

by Mike

In Excel, the If Then function, also known as the If formula, is one of the most helpful features. How to use it optimally is easy to explain.

If Then Function in Excel: Everything You Need to Know About This Useful Formula

The If Then formula is not only useful, but can also be complicated, especially for inexperienced Excel users.

  • The function consists of three parts: IFTHENELSE. This is used to check a condition and draw conclusions.
  • IF stands for the condition that is being evaluated. Excel checks whether a certain behavior applies or not.
  • THEN refers to the first consequence. If a condition defined with the Excel formula is true, THEN a certain case occurs.
  • If this THEN consequence does B notB occur, this results in a different consequence: This is defined with ELSE.
  • Note: The mathematical symbols =, >, and < are often used here. This results in the following definitions: = stands for equal. <> stands for not equal. < stands for greater than, <= for greater than or equal to. > stands for less than, >= for less than or equal to.

Structure of the Excel if-then formula: step by step

The structure itself is quite simple.
Like other formulas in Excel, you just need to know the individual components.

  • In general, the structure of the formula looks like this: =IF(condition;THEN;ELSE). Be sure to always enter the equal sign, otherwise the formula will not work.
  • Explained in words: =IF(“This condition is met;”Do this“;”Otherwise do that“). A simplified example of this would be: =IF(2=2;‘True’;”False”)
  • The = sign and the word IF initiate the function. Excel then knows what the command is and can check the corresponding condition.
  • This condition is inserted immediately after the parenthesis. In the example, this is 2=2.
  • After the first ; character, the first consequence is defined. You define this consequence. If the condition is true, THEN it is True.
  • If the first result does not apply, there is another consequence, defined by “ELSE,” which you specified after the second ; character in the formula. Complete the function with a closed parenthesis.
  • Note: The function works the same way in every version of Excel. It doesn’t matter whether you use the desktop or web version, for example.

    Excel If Then Function: Detailed Example

    Many people will be familiar with this type of task, either from school or later in their working lives.

    • Let’s assume that an online store gives customers a five euro discount if they pay their bill within 14 days.
    • Column A lists all customers, column B shows when they paid, and column C shows whether they have already received the discount or not. This is where the IF formula in Excel comes into play.
    • Select the appropriate cell in which the IF THEN function is to be used. In our example, this is initially cell C2. Here, insert the formula that will check the condition of whether the customer has paid after 14 days and whether the discount will be granted: =IF(B2<=14;5;0)
    • IF defines the condition: Has the customer paid after 14 days at the latest? This is determined by the following equation: B2<=14 - in words, this means: Is the numerical value in cell B2 less than or equal to 14?
    • The first value after the ; sign, in our example the 5, names the first consequence, the THEN part of the formula. IF the buyer has paid within 14 days, they receive a five euro discount. If this has not happened, there is no discount, i.e. 0. This is the ELSE consequence. This is determined by the value after the second ; sign in the formula.
    • If you want to extend the formula to the remaining fields in the column, you can simply drag the green rectangle used to select a cell downwards with the mouse in the lower right corner. Excel then applies the formula to the other values in the column and converts B2, B3, and so on to determine the correct consequence for the corresponding column.
    • In our example, customers Müller and Schmidt receive a discount of five euros because they paid their bills after 14 and seven days, respectively. The THEN case from the formula has been met here.
    • Meier and Huber both took longer to pay. Accordingly, they do not receive a discount. Here, the ELSE case has been met.

    Related Articles

    Leave a Comment