Multiple criteria IIF function help

C

Cam

Hello,

I am trying to create an IIF query field where if RtgGrp not equal NA or
Non, the return Yes, otherwise return No. But it is not working. What is
wrong with the formula? Thanks

NoNONV?: IIf([RtgGrp]<>"NA" or "Non","Yes","No")
 
F

fredg

Hello,

I am trying to create an IIF query field where if RtgGrp not equal NA or
Non, the return Yes, otherwise return No. But it is not working. What is
wrong with the formula? Thanks

NoNONV?: IIf([RtgGrp]<>"NA" or "Non","Yes","No")

You have to repeat the Criteria Field name fo each criteria:

NoNONV?: IIf([RtgGrp]<>"NA" or [RtgGrp]<>"Non","Yes","No")

Perhaps an easier expression to use would be:

NoNONV?:IIf([RtgGrp] In("NA","Non"), "No","Yes")
 
M

Marshall Barton

Cam said:
I am trying to create an IIF query field where if RtgGrp not equal NA or
Non, the return Yes, otherwise return No. But it is not working. What is
wrong with the formula? Thanks

NoNONV?: IIf([RtgGrp]<>"NA" or "Non","Yes","No")


Two things, you must use both operands in each comparison
and since the RtgGrp field can not be equal to both NA and
NON, the Or will always be true. Do it this way:

NoNONV?: IIf(RtgGrp<>"NA" AND RtgGrp<>"Non","Yes","No")

It is a poor practice to use a name with a non alphanumeric
character, so I strongly suggest that you get rid of the ?
in the calculated field's name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top