#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default OR in IF

Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 185
Default OR in IF

T2Net

=IF(OR(Condition1,Condition2,Condition3....),DoThi s,ElseDoThis)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.excelusergroup.org
web: www.nickhodge.co.uk





"T2net" wrote in message
...
Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default OR in IF

The or is a function like this with each condition separated by a comma:-

=IF(OR(A4=1,B4=2,C4=3),"Yes","No")

--
Regards,

OssieMac


"T2net" wrote:

Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default OR in IF

You've answered your own question:

If condition1 OR condition2 OR condition3 then action1


IS the solution. Try it!

Regards,
Stefi



€žT2net€ť ezt Ă*rta:

Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default OR in IF

Are you sure that's VBA?
--
David Biddulph

"OssieMac" wrote in message
...
The or is a function like this with each condition separated by a comma:-

=IF(OR(A4=1,B4=2,C4=3),"Yes","No")

--
Regards,

OssieMac


"T2net" wrote:

Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 510
Default OR in IF

The shortened syntax (If <LogicalCondition Then response) looks like
reasonable, but I have several times had problems with it - so I prefer the
full syntax:

If Condition Then
Action
[ElseIf ElseCondition
ElseIfAction]
[Else
ElseAction]
End If

In your case Condition is =condition1 Or condition2 Or condition3

--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"Stefi" wrote in message
...
You've answered your own question:

If condition1 OR condition2 OR condition3 then action1


IS the solution. Try it!

Regards,
Stefi



„T2net” ezt ?rta:

Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default OR in IF

Thanks David. The question came up under Worksheet Functions on the Microsoft
Forum and I did not read it properly and missed the VBA at the end of the
question and thought that a worksheet function was required.

--
Regards,

OssieMac


"David Biddulph" wrote:

Are you sure that's VBA?
--
David Biddulph

"OssieMac" wrote in message
...
The or is a function like this with each condition separated by a comma:-

=IF(OR(A4=1,B4=2,C4=3),"Yes","No")

--
Regards,

OssieMac


"T2net" wrote:

Do you know a way to include several conditions to one IFstep in VBA,
ie

If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:

If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!

Thanks in advance for your help,

T2net




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default OR in IF

On 28 fév, 09:48, Stefi wrote:
You've answered your own question:

If condition1 OR condition2 OR condition3 then action1


IS the solution. Try it!

Regards,
Stefi

"T2net" ezt írta:



Do you know a way to include several conditions to one IFstep in VBA,
ie


If condition1 OR condition2 OR condition3 then action1
without using my current unelegant and heavy:


If condition1 then action1
If condition 2 then action1
If condition 3 then action1


I am sure the trick is easy..so easy that I cannot find it!


Thanks in advance for your help,


T2net- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -


I knew it!!
I had certainly a error mixed with the or last time I tried...

Sorry for disturbing with my stupid question!

Cheers
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



All times are GMT +1. The time now is 07:41 PM.

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

About Us

"It's about Microsoft Excel"