Searching...
Tuesday, June 18, 2013

Implementing IF-ELSE logic in Excel

Like any programming language, you can implement IF-ELSE logic in Excel. The only difference if the way it is implemented. Lets consider the following programming logic in a programming language.

If cond-1 {
    action-1
}

else if cond-2 {
    action-2
}

else if cond-3 {
    action-3
}

else {
    action-4
}

It may seem difficult to implement the above logic in Excel if you are new to it, however with the right approach you its a matter of simple formula using IF function. If you are not familiar with IF function in Excel, I recommend you to follow the below tutotial first

Using 'IF' function in Excel

If you are aware, how IF works in Excel, please go continue here. If I simply translate the above logic to an Excel formula, it will be something like below

=IF(cond-1,action-1,IF(cond-2,action-2,IF(cond-3,action-3,action-4)))

As you can see that I nested IF functions and the ELSE part of the logic goes into part of the function where condition is false. If you are looking for more details on Nested IFs, please follow the below tutorial.

Using Nested 'IF' function in Excel

Please feel free to provide any feedback or for any queries.

0 comments:

Post a Comment

 
Back to top!