Iff Error

C

caro

I am attempting to create an IFf statement where if the raw score is less
than 1, a number 1 is populated in the field. If the raw score is less than
5, then the number 2 would populate in the field. If the raw score is less
than 9, a 3 would populate. If the raw score is less than 13, a 4 would
populate. And if the raw score is less than 16, a 5 would populate. My
formula is:
IFf («Expr» [Raw Score (1-5)] < [1], [1]), IFf ([Raw Score (1-5)] < [5],
[2]), IFf ([Raw Score (1-5)] < [9], [3]), IFf ([Raw Score (1-5)] < [13],
[4]), IFf ([Raw Score (1-5)] < [16], [5])
Please help!
 
D

Dirk Goldgar

caro said:
I am attempting to create an IFf statement where if the raw score is less
than 1, a number 1 is populated in the field. If the raw score is less
than
5, then the number 2 would populate in the field. If the raw score is less
than 9, a 3 would populate. If the raw score is less than 13, a 4 would
populate. And if the raw score is less than 16, a 5 would populate. My
formula is:
IFf («Expr» [Raw Score (1-5)] < [1], [1]), IFf ([Raw Score (1-5)] < [5],
[2]), IFf ([Raw Score (1-5)] < [9], [3]), IFf ([Raw Score (1-5)] < [13],
[4]), IFf ([Raw Score (1-5)] < [16], [5])
Please help!


It might be simpler and clearer to use the Switch function:

=Switch([Raw Score (1-5)]<1,1,[Raw Score (1-5)]<5,2,[Raw Score
(1-5)]<9,3,[Raw Score (1-5)]<13,4,[Raw Score (1-5)]<16,5)

What do you want to do if the value is 16 or more?
 
C

caro

When I entered in the new equation, the field populated with #Name?. Any
suggestions?
Also, the raw score should never get above 16, so that shouldn't be a problem.
Many thanks!

Dirk Goldgar said:
caro said:
I am attempting to create an IFf statement where if the raw score is less
than 1, a number 1 is populated in the field. If the raw score is less
than
5, then the number 2 would populate in the field. If the raw score is less
than 9, a 3 would populate. If the raw score is less than 13, a 4 would
populate. And if the raw score is less than 16, a 5 would populate. My
formula is:
IFf («Expr» [Raw Score (1-5)] < [1], [1]), IFf ([Raw Score (1-5)] < [5],
[2]), IFf ([Raw Score (1-5)] < [9], [3]), IFf ([Raw Score (1-5)] < [13],
[4]), IFf ([Raw Score (1-5)] < [16], [5])
Please help!


It might be simpler and clearer to use the Switch function:

=Switch([Raw Score (1-5)]<1,1,[Raw Score (1-5)]<5,2,[Raw Score
(1-5)]<9,3,[Raw Score (1-5)]<13,4,[Raw Score (1-5)]<16,5)

What do you want to do if the value is 16 or more?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

caro said:
When I entered in the new equation, the field populated with #Name?. Any
suggestions?

Where are you putting this expression? If you're specifying it as the
Control Source of a text box, did you include the leading equals sign?

Expression assumes that there is a field on your form named "Raw Score
(1-5)". That would be a bad name, since it contains non-alphanumeric
characters, but that's the name you had in your original post. But maybe
that's not the correct name; if it isn't, change it to the correct name,
all the time it appears in the expression.

Is VBA code enabled in your database? What version of Access are you using?
 
J

John Spencer MVP

Yes, make sure the name of the control is not
[Raw Score (1-5)]

I would suggest naming the control soemthing like
txtAdjustedScore

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
When I entered in the new equation, the field populated with #Name?. Any
suggestions?
Also, the raw score should never get above 16, so that shouldn't be a problem.
Many thanks!

Dirk Goldgar said:
caro said:
I am attempting to create an IFf statement where if the raw score is less
than 1, a number 1 is populated in the field. If the raw score is less
than
5, then the number 2 would populate in the field. If the raw score is less
than 9, a 3 would populate. If the raw score is less than 13, a 4 would
populate. And if the raw score is less than 16, a 5 would populate. My
formula is:
IFf («Expr» [Raw Score (1-5)] < [1], [1]), IFf ([Raw Score (1-5)] < [5],
[2]), IFf ([Raw Score (1-5)] < [9], [3]), IFf ([Raw Score (1-5)] < [13],
[4]), IFf ([Raw Score (1-5)] < [16], [5])
Please help!

It might be simpler and clearer to use the Switch function:

=Switch([Raw Score (1-5)]<1,1,[Raw Score (1-5)]<5,2,[Raw Score
(1-5)]<9,3,[Raw Score (1-5)]<13,4,[Raw Score (1-5)]<16,5)

What do you want to do if the value is 16 or more?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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