MSGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Multiple IF conditions-AND/OR

• Follow

```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

```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

```Try nested if statements:

If (Cond1) and (Cond2) Then
If (Cond3a) or (Cond3b) or (Cond3c) Then
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

2 Replies
421 Views

Similiar Articles:

7/16/2012 5:49:39 PM