Solved Convert this excel formula to work in query

Number11

Member
Local time
Today, 09:04
Joined
Jan 29, 2020
Messages
625
Hello

I have this in a spreadsheet that works all fine i want to create this within a Ms Query...


=IF((OR(AC2="yes",AD2="yes",AE2="yes")),"Yes","")

My fields are

BOOKED
DELIVERED
OUTSTANDING

I tried this but doesnt work

=IF((OR([BOOKED]="yes",[DELIVERED]="yes",[OUTSTANDING]="yes")),"Yes","")
 
I do not believe Access has an OR() function, just the OR keyword ?
 
hi @Number11 ,

are the fields defined to be Yes/No in Access? If so

=IIF([field1]=true or [field2]=true or [field3]=true, true, false)
 
or simply:

=IIF([BOOKED] + [DELIVERED] + [OUTSTANDING], "Yes", "")
 
I don't use functions when there are other alternatives.
if you will follow the OP, he is outputting a "Yes" to a column (possibly calculated).
 
assuming this is a control and the fields are a boolean type then

=[BOOKED] OR [DELIVERED] OR [OUTSTANDING]

and set the format of the control to ;"Yes";""
 
assuming this is a control and the fields are a boolean type then

=[BOOKED] OR [DELIVERED] OR [OUTSTANDING]

and set the format of the control to ;"Yes";""
No this does not work

Test

BOOKED
DELIVERED
OUTSTANDING
Results
NoNoYes
-1​
NoYesNo
-1​
same result even when a yes is present :)
 
see post#1 for your condition, that is Exactly the same as you write it in excel.
 
PMFJI, but that's what you wanted? Any yes in those three fields = yes?

-1 Is Yes in Access.
 
PMFJI, but that's what you wanted? Any yes in those three fields = yes?

-1 Is Yes in Access.
yes for those with a yes i can also seeing the same when all 3 are the no



BOOKEDDELIVEREDOUTSTANDINGExpr1
NoNoNo
-1​
 
re post #9 - assuming Expr1 is your formula it appears to be working to me - each row has a yes in it and because it is or's it will return true - you just haven't formatted it

;"Yes";""

and what does this mean?

same result even when a yes is present :)

you will get the same result whenever there is a yes
 
re post #9 - assuming Expr1 is your formula it appears to be working to me - each row has a yes in it and because it is or's it will return true - you just haven't formatted it

;"Yes";""

and what does this mean?



you will get the same result whenever there is a yes
no its not working see...

yes for those with a yes i can also seeing the same when all 3 are the no



BOOKEDDELIVEREDOUTSTANDINGExpr1
NoNoNo-1
 
Hello

I have this in a spreadsheet that works all fine i want to create this within a Ms Query...


=IF((OR(AC2="yes",AD2="yes",AE2="yes")),"Yes","")

My fields are

BOOKED
DELIVERED
OUTSTANDING

I tried this but doesnt work

=IF((OR([BOOKED]="yes",[DELIVERED]="yes",[OUTSTANDING]="yes")),"Yes","")
Perhaps this slipped past. Several previous posters did mention it.

In Access, Boolean fields (those with two possible values, i.e. "True" or "False", "Yes" or "No") are stored in tables as -1 and 0, where 0 is false, or no, and -1 is true, or yes.

In your Access expression, therefore, you do NOT check "yes" or "no", you check -1 or 0.

It's possible that you have stored strings, not Booleans, in which case you could put anything in that field in the table, in addition to "yes" or "no" because a string isn't limited to the Booleans.

So, depending on whether you really do have a Boolean, or merely a string of letters, you have to craft the expression appropriately.
 
Perhaps this slipped past. Several previous posters did mention it.

In Access, Boolean fields (those with two possible values, i.e. "True" or "False", "Yes" or "No") are stored in tables as -1 and 0, where 0 is false, or no, and -1 is true, or yes.

In your Access expression, therefore, you do NOT check "yes" or "no", you check -1 or 0.

It's possible that you have stored strings, not Booleans, in which case you could put anything in that field in the table, in addition to "yes" or "no" because a string isn't limited to the Booleans.

So, depending on whether you really do have a Boolean, or merely a string of letters, you have to craft the expression appropriately.
changed to -1 still doent work
 
changed to -1 still doent work
Please state clearly then, what does it mean to say "...doesn't work" ? Do you get an error, wrong answers, NO answers?

Show us the actual result required.

Show us the actual result returned.

Explain the difference to be sure we all understand the nature of the problem.

Thank you.
 
@Pat Hartman - you have a extra ) ;)

=IIF([BOOKED]="yes" OR [DELIVERED]="yes" OR [OUTSTANDING]="yes"),"Yes","")
STILL DOES NOT WORK

1642615711008.png
 
23 posts in and all we get is 'It does not work' :( :( :(

Upload a sample DB so someone can get it to work for you.
 

Users who are viewing this thread

Back
Top Bottom