In Visual Basic Editor, we use IF and then Else condition to control output based different condition in MS Excel. We will, now, discuss how to use IF, and then Else to check the multiple condition for the particular output.
Let’s take an example to understand: –
We want to check if Score is equal to or greater than 60, then result should either be passed or failed respectively. To record a macro, follow below given steps: –
- Insert the Command button from the Developer tab.
- And then assign the Macro.
- VBE page will get open.
- Write the below mentioned code: –
When you will click on Command, you will get the result in cell B1, according to the score mentioned in A1 cell.