Wauvel

Excel like a finance pro.

← The library

VBA · Control flow

Select Case

Chooses between many branches based on one value; cleaner than a long ElseIf chain.

CommonDifficulty 1150 · Proficient
Practice · 2 questions →

When to use it

Select Case tests one value against a list of cases, including lists, ranges, and comparisons. It replaces long ElseIf chains.

The code

Code
Select Case region
  Case "West", "East": rate = 0.1
  Case Is > 5: rate = 0.2
  Case Else: rate = 0
End Select

Worked examples

  • Mixed cases

    Select Case region Case "West", "East": rate = 0.1 Case Is > 5: rate = 0.2 Case Else: rate = 0 End Select Lists, comparisons, and a default

    The full toolkit.

  • Ranges

    Select Case score Case 90 To 100: grade = "A" Case 80 To 89: grade = "B" Case Else: grade = "F" End Select Numeric ranges

    Grade bands.

  • Select Case True

    Select Case True Case x > 10 And y > 10: ... Case x > 10: ... End Select The first true condition wins

    Complex conditions in order.

Worth knowing

  • Only the first matching Case runs.
  • Case Else catches surprises; always include one.
  • Case Is > 5 needs the word Is for comparisons.

Where it goes wrong

  • String matching is case sensitive by default.
  • Overlapping ranges silently take the first match.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.