A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple criteria IIF function help



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2010, 05:18 PM posted to microsoft.public.access.queries
Cam
external usenet poster
 
Posts: 253
Default Multiple criteria IIF function help

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")
  #2  
Old May 17th, 2010, 05:52 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default Multiple criteria IIF function help

On Mon, 17 May 2010 09:18:01 -0700, Cam wrote:

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")

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old May 17th, 2010, 06:11 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Multiple criteria IIF function help

Cam wrote:
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.

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:07 AM.


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