Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Multiple IF conditions-AND/OR

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Multiple IF conditions-AND/OR

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting multiple conditions to return a figure from multiple cells Sapper Excel Discussion (Misc queries) 4 April 26th 09 10:33 PM
SUMPRODUCT or INDEX/MATCH for multiple conditions and multiple rec TravisB Excel Discussion (Misc queries) 21 March 16th 07 09:49 PM
Multiple conditions and multiple return values Minerva Excel Worksheet Functions 3 February 16th 06 06:57 AM
Combining Text from multiple cells under multiple conditions KNS Excel Worksheet Functions 2 June 15th 05 11:00 PM
How to multiple conditions to validate more than 2 conditions to . Bhuvana Govind Excel Worksheet Functions 1 January 28th 05 07:07 PM


All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"