IF is one of the popular function in Excel. It is the favorite function for many excel users. IF Function works with logic. It tests the logical condition and returns the result. The default result of this function is TRUE/FALSE. But you can manipulate the result with your own. IF function is applicable for text and numbers both. In this lesson, we will learn the different application of IF Function.
IF is a function that works with any specific condition and returns the result TRUE if the condition is true and returns the value FALSE if the condition is false.
= IF(logical_test, [value_if_true], [value_if_false])
Let’s discuss the example. I placed the example below as their difficulty level:
IF function with NUMBER:
|Not Equal to||<>||=IF(A2<>10,TRUE,FALSE)|
|Greater than or Equal to||=>||=IF(A2>=10,TRUE,FALSE)|
|Less than or Equal to||<=||=IF(A2<=10,TRUE,FALSE)|
In the above image, I tried to show you some uses of the IF function. If we consider the number 1 formula, we used C4>10 as a condition and our value C4=10 is not greater than 10 so the result is FALSE. And rest of the formula you should try to clear your concept.
Getting result TRUE and False is not usually every time. We can use our own result instead of TRUE/FALSE like below:
Also we can get resulted text from cell reference also, like:
We can also use formula instead of TRUE/FALSE or Text result. So, let’s see an example:
In the above example, I tried to find absolute subtraction of Data1 and Data2. In excel there are several ways to do this operation. But I used a simple subtraction formula. Here the main challenge is if I use =B5-C5 as formula than we will get negative value as a result for some case. So I use IF formula.
How the above formula will work:
The condition of the formula is B5>C5. If the condition is true then the result will generate as B5-C5 and if the condition is false then the result will generate C5-B5. In the 3rd row, you will find the different case. Here the second column data is higher than first column data.
IF function with TEXT:
If function also can work with text. Here I have mentioned a sample call center data as an example:
In the above sheet, we can see a text-based IF formula. Here the logic is IF(D4=”Called” . If the condition is TRUE than the result will come “Call today” or if the condition is false then the result will come “No call needed”.