Should the following IIF statments work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])
 
Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])


I think the False condition is required. IIF(condition, do if true, do
if false).
 
Yes they are fine - provideing you don't want to see any results if they IIf
is false
Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT true.

Hope this helps

--
Wayne
Manchester, England.



pgarcia said:
Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])
 
Ok, I put a "False" statement in the express and it still does not work. I do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they IIf
is false
Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT true.

Hope this helps

--
Wayne
Manchester, England.



pgarcia said:
Should the following IIF statments work? I get blank cells. FYI, It's text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit Center])
 
What is Expr12? A calculated field in a query? You cannot refer to
calculated fields in that way: you have to repeat whatever calculation it is
you've assigned to the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


pgarcia said:
Ok, I put a "False" statement in the express and it still does not work. I
do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they
IIf
is false
Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination
you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like
this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT
true.

Hope this helps

--
Wayne
Manchester, England.



pgarcia said:
Should the following IIF statments work? I get blank cells. FYI, It's
text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center])
 
Thanks, how should I do that?

Douglas J. Steele said:
What is Expr12? A calculated field in a query? You cannot refer to
calculated fields in that way: you have to repeat whatever calculation it is
you've assigned to the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


pgarcia said:
Ok, I put a "False" statement in the express and it still does not work. I
do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they
IIf
is false

Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination
you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like
this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT
true.

Hope this helps

--
Wayne
Manchester, England.



:

Should the following IIF statments work? I get blank cells. FYI, It's
text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center])
 
I thought about somthing, I already have an IIF statment that does that and
it works:

Expr12: IIf([CVR 6TH RUN]![Expr11]=[CVR 6TH RUN]![Expr10],[CVR 6TH
RUN]![Expr11],[CVR 6TH RUN]![Expr10])

Douglas J. Steele said:
What is Expr12? A calculated field in a query? You cannot refer to
calculated fields in that way: you have to repeat whatever calculation it is
you've assigned to the field.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


pgarcia said:
Ok, I put a "False" statement in the express and it still does not work. I
do
get the "Zero" to come up, but that should not be the results. Any ideas?

Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center],"Zero")
Also reversed it and it does not seem to work
Expr10: IIf([All Stations]![STN CD]=[Expr12],[All Stations]![Profit
Center],"Zero")

Does it matter if the data is text or not?

Wayne-I-M said:
Yes they are fine - provideing you don't want to see any results if they
IIf
is false

Expr10: IIf([STN CD]=[Destination],[Profit Center])

If the contents of the field equal the contents of the field Destination
you
will get the contents of the field Profit Centre.
If the contents of the field DO NOT equal the contents of the field
Destination you will nothing

As long as this is what you want it's fine.

You could always include something to show is the answer if false like
this
Expr10: IIf([STN CD]=[Destination],[Profit Center],"SomethingElse")
This would give the text string "SomethingElse" if the argument is NOT
true.

Hope this helps

--
Wayne
Manchester, England.



:

Should the following IIF statments work? I get blank cells. FYI, It's
text in
the fields.

Expr10: IIf([STN CD]=[Destination],[Profit Center])
or
Expr10: IIf([Expr12]=[All Stations]![STN CD],[All Stations]![Profit
Center])
 

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

Similar Threads

dlookup or iff? 1
IIF 4
Help with iif statement in query 3
Too many IIF statements 3
sum of calculated fields in header of report 1
iif and statement 2
Multiple iif challenge 2
Data Mismatch in Excel 2010 4

Back
Top