Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to write:
If Left(s,2) = "Mr" Or Left(s,2) = "Ms" Then ...statements... End If But that will evaluate both Or operands even if the first one is true. Is there a more efficient way to implement this? Note: That example is a simplification. In actual practice, the conditional expressions are more complicated. So don't try to optimize the particular example. Optimize the paradigm. My best: doit = (Left(s,2) = "Mr") If Not doit Then doit = (Left(s,2) = "Ms") If doit Then ...statements... End If But that gets a little tedious. Alternatively: Select Case True Case Left(s,2) = "Mr", Left(s,2) = "Ms" ...statements.... End Select But that seems a bit convoluted. Am I overlooking the obvious? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I optimize this code? | Excel Programming | |||
Conditional Expression in cell | Excel Worksheet Functions | |||
Conditional Expression Question | Excel Worksheet Functions | |||
Conditional Formatting OR Expression?? | Excel Discussion (Misc queries) | |||
Optimize SumProduct | Excel Discussion (Misc queries) |