Iff statement

G

Guest

I would like to use an if statement to display text, dependent on data in
field.
for example ; If [field] = "C", then display "completed", or if [field]
is = "D" then display "Do over", or if [field] = "M" then display "Move".

I thought I could make it work with an IIF statement, but I cannot seem to
get it right.

Any help would be appreciated.
 
F

fredg

I would like to use an if statement to display text, dependent on data in
field.
for example ; If [field] = "C", then display "completed", or if [field]
is = "D" then display "Do over", or if [field] = "M" then display "Move".

I thought I could make it work with an IIF statement, but I cannot seem to
get it right.

Any help would be appreciated.

=IIf([FieldA] = "C","Completed",IIf([FieldA]="D",Do Over","Move"))

The above assumes there are just the 3 choices, C,D,or M, and it will
always have an entry.

If there is a possibility that no value will be entered, then use:

=IIf([FieldA] = "C","Completed",IIf([FieldA]="D","Do Over",
IIf([FieldA] = "M","Move","No Entry")))
 
V

Van T. Dinh

For 3 or more alternatives, I prefer to use the Switch() function (for 2
alternatives the IIf() function). Something like:

= Switch([Field1] = "C", "Completed", [Field1] = "D", "Do Over",
[Field1] = "M", "Move")
 
A

Allan Murphy

It would be more efficient to use a Case Statement.

Allan Murphy

Email: (e-mail address removed)
 

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