So if we entered 'N' in cell A2, we want 'North' to appear in cell C2. In the first video example, we are going to use the IF-THEN-ELSE statement to update cell C2 with 'North', 'South', 'East' or 'West' depending on the region code entered in cell A2. If LRegion ='N' Thenįinally, let's look at an example that uses Else.
Next, let's look at an example that uses ElseIf. Let's look at some Excel IF-THEN-ELSE statement function examples and explore how to use the IF-THEN-ELSE statement in Excel VBA code:įirst, let's look at a simple example.
The IF-THEN-ELSE statement can only be used in VBA code in Microsoft Excel.