ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   OR in IF (https://www.excelbanter.com/excel-worksheet-functions/178156-if.html)

T2net

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

Nick Hodge[_2_]

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



OssieMac

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


Stefi

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


David Biddulph[_2_]

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




Arvi Laanemets

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




OssieMac

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





T2net

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


All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com