|
|
Multiple IF conditions-AND/OR
Hello,
I have the following If/Then statement set up.
If (Cond1) and (Cond2) and (Cond3a) or (Cond3b) or (Cond3c) Then
I want the "then" to be fulfilled only if BOTH Conditions 1 AND 2, as well
as "at least one" of the # 3 conditions are true. How would I properly use
and/or combinations as well as parenthese/brackets?
I thought it might be something like this, but it didn't work:
If (Cond1) and (Cond2) and [(Cond 3a) or (Cond3b) or (Cond3c)] Then
|
|
0
|
|
|
|
Reply
|
Utf
|
1/15/2010 5:28:01 AM |
|
Try
a = 1
b = 2
c = 5
If a = 1 And b = 2 And (c = 3 Or c = 4 Or c = 5) Then
MsgBox "Success"
End If
--
Jacob
"richzip" wrote:
> Hello,
>
> I have the following If/Then statement set up.
>
> If (Cond1) and (Cond2) and (Cond3a) or (Cond3b) or (Cond3c) Then
>
> I want the "then" to be fulfilled only if BOTH Conditions 1 AND 2, as well
> as "at least one" of the # 3 conditions are true. How would I properly use
> and/or combinations as well as parenthese/brackets?
>
> I thought it might be something like this, but it didn't work:
>
> If (Cond1) and (Cond2) and [(Cond 3a) or (Cond3b) or (Cond3c)] Then
>
|
|
0
|
|
|
|
Reply
|
Utf
|
1/15/2010 5:34:01 AM
|
|
Try nested if statements:
If (Cond1) and (Cond2) Then
If (Cond3a) or (Cond3b) or (Cond3c) Then
...your code here
EndIf
EndIf
Hope that helps :)
"richzip" wrote:
> Hello,
>
> I have the following If/Then statement set up.
>
> If (Cond1) and (Cond2) and (Cond3a) or (Cond3b) or (Cond3c) Then
>
> I want the "then" to be fulfilled only if BOTH Conditions 1 AND 2, as well
> as "at least one" of the # 3 conditions are true. How would I properly use
> and/or combinations as well as parenthese/brackets?
>
> I thought it might be something like this, but it didn't work:
>
> If (Cond1) and (Cond2) and [(Cond 3a) or (Cond3b) or (Cond3c)] Then
>
|
|
0
|
|
|
|
Reply
|
Utf
|
1/15/2010 8:01:01 AM
|
|
|
2 Replies
421 Views
(page loaded in 0.138 seconds)
|
|
|
|
|
|
|
|
|