Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAN'T GET MY "IF" STATEMENT TO WORK---HELP 1

Status
Not open for further replies.

nomi1

Programmer
Oct 17, 2006
16
0
0
US
WHENEVER I ENTER THE FOLLOWING IF STATEMENT INTO MY CALCULATED FIELD IT COMES BACK AND SAY I NEED AN IDENTIFIEER. WHAT DOES THAT MEAN?

=IF([POST WORK QUERY.Earned Hrs]>90,"SENIOR",IF([POST WORK QUERY.Earned Hrs]>60,"JUNIOR",IF( [POST WORK QUERY.Earned Hrs]>30,"SOPHOMORE",IF( [POST WORK QUERY.Earned Hrs]>0,"FRESHMAN","value missing"))))

 
I think you want an 'Immediate If'.

iif(condition,ReturnIfTrue,ReturnIfFalse)

You can nest iif statements inside each other.

You cannot use plain 'if' in a calculated field.

That help?

Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
TONY,

THANK YOU FOR YOU REPLY, BUT TODAY I AM UNUSUALLY BRAIN CHALLENGED! COULD YOU PLEASE SHOW ME WHAT YOU MEAN?

THIS IS MY STATEMENT BELOW - WHERE WOULD I MAKE THE CHANGE?

IF([POST WORK QUERY.Earned Hrs]>90,"SENIOR",IF([POST WORK QUERY.Earned Hrs]>60,"JUNIOR",IF( [POST WORK QUERY.Earned Hrs]>30,"SOPHOMORE",IF( [POST WORK QUERY.Earned Hrs]>0,"FRESHMAN"))))
 
A quick look?

Change 'if' to 'iif'.

I didn't examine it for correct comma placement or correct number of ending parends. But looks pretty good otherwise.

And you should read the HELP on IIF, so you know what/why.

Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Maybe I should have been more clear.

Every place you have IF, change it to IIF.



Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top