Switch Function and Negative Value

N

nxqviet

I have a list of Variance Percentages that ranges from -35%, to 25%, I
want to assign a Grade to this value using a query and write in the a
Switch Expression.

It Looks like this:

Switch([VarianceP]<-35,"F",[VarianceP]<-30,"D-",[VarianceP]<-25,"D",[VarianceP]<-20,"D+",[VarianceP]<-15,"C-",[VarianceP]<-10,"C",[VarianceP]<-5,"C+",[VarianceP]<-0,"B-",[VarianceP]<5,"B",[VarianceP]<10,"B+",[VarianceP]<15,"A-",[VarianceP]<20,"A",True,"A+")

This function will not evaluate any Negative value, thus, all Variance
that is below 0 will have a Grade of B-. Anyone have an idea of how to
fix this problem and force the function to evaluate all values?

Thanks for your time and assistance,

V_
 
G

Guest

The only possibility I see is that your VarianceP values are stored as
decimal fractions (e.g. .35) and your function is looking for integers (you
may be displaying the VarianceP as a percentage, but the underlying value in
the table is a decimal fraction). This would make all negative VarianceP
values fall in the category of < 0 (above the < 5 check) and thus produces
"B-" in all cases. If this is so, consider making the values in the Switch
function decimal fractions as well, or change the stored values to integers.
 

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