So a grade of "A" or "B" will have a corresponding comment value of "Great Work", a grade of "C" will have a comment of "Needs Improvement", and all other grades will have the comment "Time for a Tutor". We want to update the comment value in column C based on the grade in column B. In the second video example, we have a list of students in column A and their corresponding grade in column B. If we entered "S" in cell A2, we want "South" to appear in cell C2, and so on. 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. The Boolean code is roughly 10 times faster than using Strings. If LRegion ="N" Thenįinally, let's look at an example that uses Else. In the example below bMale, bFemale and bUnisex are Boolean variables. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |