Iif and + or (1 Viewer)

jeran042

Registered User.
Local time
Yesterday, 17:57
Joined
Jun 26, 2017
Messages
127
Here is what I am trying to do,
I need to meet three conditions. If txt_1 is above 5 OR less than -5 AND txt_2 is greater than 5000.

Not sure how to go about this. Here is what I have so far.

Any help or guidance is appreciated,

Code:
=IIf([txt_1]>="5",IIf([txt_1]<="-5" And [txt_2]>="5000","TRUE","FALSE"))
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:57
Joined
Oct 29, 2018
Messages
21,454
Hi. How about?
Code:
IIf((txt_1>5 OR txt_1<-5) AND (txt_2>5000),True,False)
 

plog

Banishment Pending
Local time
Yesterday, 19:57
Joined
May 11, 2011
Messages
11,638
txt_1 is above 5 OR less than -5 AND txt_2 is greater than 5000

In English, that's ambiguous. You need to express that mathematically to be clear. Do you mean:

A: (txt_1>5 OR txt_1<-5) AND txt_2>5000
Or
B: txt_1>5 OR (txt_1<-5 AND txt_2>5000)

When you mix ANDs and ORs you need to be explicit by using parenthesis.
 

Mark_

Longboard on the internet
Local time
Yesterday, 17:57
Joined
Sep 12, 2017
Messages
2,111
IIF( ABS(Me.Txt_1) > 5, IIF(me.txt_2 > 5000, TRUE, FALSE), FALSE)
 
Last edited:

Users who are viewing this thread

Top Bottom