Excel IF Function is well known among Spreadsheet users, it is MUST know Function if you want to make a logical comparison of various conditions.
It allows you to make a logical comparison between a value and what you anticipate. In the simplest form, IF Function can be explained as below:
=IF (Something Is True,
Then Do Something,
Otherwise Do Something Else)
I always consider IF Function as decision making Excel Function, it is simple, yet you can make it more powerful if by using it with other advance functions, IF Function is more of programming Function, and it is a well known concept in programming, actually Excel team has borrowed this concept from other programming languages.
Lets understand IF Function and its syntax with layman analogy and below animation, suppose you are going to market to buy fruits specially APPLE.
While In store, we will check first whether apple is ripe and eatable? If yes, then we will decide to buy the apple or else we will decide not to buy it.
Please Watch Below video (from my YouTube Channel), explaining basics of IF Function with easy to follow example.
Nested IF Statements
Nested IF functions, meaning one IF function inside of another, allow you to test multiple criteria and increases the number of possible outcomes.
Continuing with our example of buying fruits from the market. Suppose we had to take at least one fruit out of limited choices we had.
Since Apple was not ripe we had decided not to buy the apple; instead, we have the option to purchase Banana instead, now we also want to bring home only ripe and good quality banana, so if Banana is not ripe, we will not buy the banana.
We will finally choose to buy Mango which was in excellent condition.
Please see below animation to understand the syntax of Nested IF Statement in an easy way and visually!
Please Watch Below video (from my YouTube Channel), explaining basics of Nested IF Statements with easy to follow example.
Warning: Be careful while using Nested IF statements and mega formulas, this kind of mega formulas can easily get huge, and it is tough (if not impossible) to debug. Try to split your solutions in logical fragments and if possible, make a note of each logic.
And Function (Conditions)
Use the AND function to determine if all conditions in a test are TRUE.
If any logical test/condition is FALSE (out of many logical test you trying to test), AND Function gives you the FALSE result (i.e. your condition fails). All logical tests/ conditions must be TRUE to return TRUE result and pass the test.
Syntax of AND Function is below
=AND (Logical Test1, Logical Test2, Logical Test3….)
OR Function (Conditions)
=OR (Logical Test1, Logical Test2, Logical Test3….)
with OR Function, you can also test multiple logics and if ANY of these logical tests are TRUE, then only you will get a TRUE result from the entire test.
While testing all these conditions with OR function, if we ALL of the logical tests are false, the entire Function gives a FALSE result and condition we were testing with AND Function fails.
Please see below animation to understand the concept and syntax of AND Function visually.
Please Watch Below video (from my YouTube Channel), explaining AND and OR Functions along with IF Statement with easy to follow example.
If you would like to see the complete video tutorial for Excel’s IF Function from Basic to Advance, please check out below video on my YouTube Channel.
If you have any question or share your thoughts, please leave them below in comments section. If you have enjoyed the post, please do not forget to share it on your favourite social media