Nested If Function Using VBA

Nested IF Function Macro
Last time we saw how we can use a simple IF-Function Macro to take care of two conditions. What if we wish to handle multiple conditions like grades based on marks ranges or discounts based on various quantities purchased or bonus based on a range of sales? Here we can use the nested-if function macros to automate the process of calculations or analysis.
The code is given below and it’s easy to understand. Instead of ‘else’ we use ‘elseif’ and for the last condition we use ‘else’. You can have upto 64 nested IFs in Excel 2007.