View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ken Wright Ken Wright is offline
external usenet poster
 
Posts: 634
Default Nested IF statements

And nor do Excel formulas when the right one is used, ie VLOOKUP :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"Bruno Campanini" wrote in message
...
"misstrious" wrote in message
ups.com...
In an ideal world I would do a 22 nested If statement to check but
unfortunately Excel 2000 will only allow 7.

What I have is a random subset of 5 values from 22 possibilities.

The "english" for the formula is like this:

If A2 = "Fri" then If B2 = Medic, a+b, if B2 = Home, b+c, so on and so
forth for 22 possible options.

I am unfamiliar with VBA but am sure this is not that difficult an
equation to programme.


VBA doesn't suffer such a nesting limitation.

If [DV22] = 1 Then
MsgBox [DV22]
ElseIf [V22] = 2 Then
MsgBox [V22]
ElseIf [D2] = 3 Then
MsgBox [D2]
ElseIf [F3] = 4 And [G3]=6 Then
MsgBox [G3]
ElseIf [DV22] = 5 And [A2]=3 Or [K12]="wss" Then
.........................
End If

Bruno