

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. Therefore, the result in the cell B3 is “B3 is lower than C3”.

Now the logical condition is FALSE since 7 is not greater than 12. Using the IF function to compare two cells Insert the formula: =IF(B3>C3,"B3 is greater than C3", "B3 is lower than C3")įigure 3.=IF(B3>C3,"B3 is greater than C3", "B3 is lower than C3") In the cell D3, we want to get the result. The value_if_true is “B3 is greater than C3”, while the value_if_false is “B3 is lower than C3”. The example is similar, but now we put 7 in B3 and 12 in C3. In this example, we will provide cells references to the function, instead of numbers. Using the IF Function to Compare Two Cells Therefore, the result in the cell B3 is “5 is greater than 3”. The logical_test 5>3 is TRUE, so the IF function returns value_if_true. Using the IF function to compare two numbers Insert the formula: =IF(5>3,"5 is greater than 3", "5 is lower than 3")įigure 2.

To apply the IF function, we need to follow these steps: The value_if_true is “5 is greater than 3”, while the value_if_false is “5 is lower than 3”. The parameter logical_test is 5>3, as we want to check if 5 is greater than 3. =IF(5>3,"5 is greater than 3", "5 is lower than 3") In case this is true, we return the message “5 is greater than 3”, and if it’s lower “5 is lower than 3”. In our example, we want to check if 5 is greater than 3. value_if_false – a value which the function returns if a logical_test is FALSE.Ĭompare Two Numbers Using the IF Function.value_if_true – a value which the function returns if a logical_test is TRUE.logical_test – a logical expression that we want to check.=IF(logical_test, value_if_true, value_if_false) The generic formula for the IF function is: The result of the IF function Syntax of the IF Formula This step by step tutorial will assist all levels of Excel users in using the IF else function.įigure 1. This is possible by using the IF function which returns Boolean TRUE or FALSE as a result. Excel allows a user to use a logical expression in order to check if a condition is true.
