Close
    Search Search

    How to Use the If Function in Excel

    The If function in Excel lets you unroll formulas or perform a specific calculation only when a value condition is met. It makes the spreadsheet much more flexible in processing your data. In this article we will see how to use the if formula of Excel in a practical way.

    How to Use the If Function in Excel

    You regularly use the software Excel ? If so, you must have already seen or heard of the If function, one of those that makes the spreadsheet really powerful. It allows a logical comparison to be made between a value and the condition desired by the user. If this is respected, the instruction is executed. Otherwise, the formula executes an alternate statement.



    Excel: What are the use cases of the If function?

    Concretely, here is how the structure of an If formula looks in Excel: If(logical_test;[value_if_true];[value_if_false]). You are told what each element of the formula corresponds to.

    • logic_test represents the condition to be tested.
    • [Value_if_true] : the value to return or an instruction to execute.
    • [Value_if_false] corresponds to the value to return if the initial condition is not met.

    Concrete example of using the If formula

    Let's take the basic example of a stock card in Excel. We want to check if a product is sold out. For this, we will display the word Exhausted when the stock value is 0. This is the main condition. When it is not respected, we will instead display the character string In stock.

    Here is the formula to use with the function. Look at the screenshot below to find yourself in the cells: =SI(B2=0;”Sold out”;”In stock”). We start of course with the sign = before the beginning of the formula.



    How to Use the If Function in Excel

    You can also use other logical comparators in the condition of the Excel formula. Apart from the sign of equality, it is possible to condition the operator of superiority or inferiority. For example, in the tracking sheet, you can anticipate any stock shortage by defining a critical threshold.

    Thus, when a quantity is less than a number (ex: 10), we display Critical stock in the corresponding column C. The formula would then be = YES (B2 = <10; "Critical Stock"; "In Stock").

    This is how the If function works in Excel in a practical way. Note that in the case of our example, it is also possible to use conditional formatting to color a cell red when the stock quality is exhausted or has reached a critical level.


    You can check out our article on using conditional formatting in Excel. As the name suggests, this involves applying specific formatting to a cell when the value in it meets a condition.

    The editorial advises you:

    1. Excel: how to use the vlookup and hlookup functions
    2. How to round in Excel (up or down)
    3. How to password protect a Word or Excel document
    The ability to speed up or slow down a video on YouTube can be very useful. It was possible to do this in the web version of the platform for a while…Facebook allows you to deactivate the automatic playback of videos in your news feed. It's very simple, even if the path is not obvious to anyone who has never seen it...Google Chrome includes a reading mode that allows you to consult a page in optimal conditions. The functionality, however, is hidden in the bowels of the browser. In this tutorial,…It is easy to know if a contact has blocked you on WhatsApp, but some indicators can also trick you into believing it unfairly. So how do you know...
    add a comment of How to Use the If Function in Excel
    Comment sent successfully! We will review it in the next few hours.