I need an expression to return multiple results

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

Guest

I've tried a varity of possibilities. I'm trying to write an expression that
will return different answers based on the results in a given field. the
FINAL: IIf([TOTAL]>"84","4") works perfectly but I'm looking for a way to get
the answer to come up with <"65",1, between 65 and 74, 2 and between 75 and
84, 3.

Can anyone help???
 
FINAL: IIf([TOTAL] < "65", "1", IIf([TOTAL] <= "74", "2", IIf([TOTAL] <=
"84","3", "4")))

or

FINAL: Switch([TOTAL] < "65", "1", [TOTAL] >= "65" And [TOTAL] <= "74", "2",
[TOTAL] > "74" And [TOTAL] <= "84", "3", [TOTAL] > "84", "4)

On the other hand, from the name, I would expect [TOTAL] to be a numeric
field, not text, in which case you don't want the quotes around the values.
 
Thanks, your a life saver. It worked perfect!
--
Lori A. Pong


Douglas J Steele said:
FINAL: IIf([TOTAL] < "65", "1", IIf([TOTAL] <= "74", "2", IIf([TOTAL] <=
"84","3", "4")))

or

FINAL: Switch([TOTAL] < "65", "1", [TOTAL] >= "65" And [TOTAL] <= "74", "2",
[TOTAL] > "74" And [TOTAL] <= "84", "3", [TOTAL] > "84", "4)

On the other hand, from the name, I would expect [TOTAL] to be a numeric
field, not text, in which case you don't want the quotes around the values.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Lori said:
I've tried a varity of possibilities. I'm trying to write an expression that
will return different answers based on the results in a given field. the
FINAL: IIf([TOTAL]>"84","4") works perfectly but I'm looking for a way to get
the answer to come up with <"65",1, between 65 and 74, 2 and between 75 and
84, 3.

Can anyone help???
 

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

Back
Top