Jump to content
Server Maintenance This Week. ×

Multiple If functions


This topic is 4983 days old. Please don't post here. Open a new topic instead.

Recommended Posts

What is wrong with this function? It is telling me that an operator is expected at the last semi colon and beyond. Like it doesn't like the last part.

If ( Appointment Type = "C" ; If ( Total TIme > 1 ;"O" ) ; Appointment Type ) ; Appointment Type

Link to comment
Share on other sites

You are missing the end bracket but tell us what you want in human words. Even if we solve your calculation, it wouldn't be very efficient.

UPDATE: For instance, it sounds like you want this:

If there is a number in total time and the Type is "C", enter a "O" otherwise leave it as it stands still with the Appointment Type. Is that what you want?

Hi Daniele! :smile2:

Edited by Guest
Link to comment
Share on other sites

What is wrong with this function? It is telling me that an operator is expected at the last semi colon and beyond. Like it doesn't like the last part.

If ( Appointment Type = "C" ; If ( Total TIme > 1 ;"O" ) ; Appointment Type ) ; Appointment Type

Semi colons delimit function parameters. Parens enclose function parameters. You have a function, If(), and all the parameters (test; result; default result) need to be within parens.

In short, move your last parens to the very end.

If you moved your last parens to the very end, you'd be enclosing your function, but you'd have 4 parameters which is too many for If(). Delete the last "; Appointment Type".

Edited by Guest
Link to comment
Share on other sites

You are missing the end bracket but tell us what you want in human words. Even if we solve your calculation, it wouldn't be very efficient.

If I add the end parenthesis it says I do not have an equal number of parenthesis.

Here is what I want,

If the appointment type is "C" I want it to be changed to an "O" if the total time is more than 1 hour.

Link to comment
Share on other sites

If you moved your last parens to the very end, you'd be enclosing your function, but you'd have 4 parameters which is too many for If(). Delete the last "; Appointment Type".

If I delete the last ; Appointment Type then it would be an incomplete function. I'm trying to create a nested if function. So:

If (test1=1 ; if ( test2=2 ; result1b ; result2b) ; result 1b

Link to comment
Share on other sites

I'm trying to create a nested if function.

Why not use the Case() function instead?

---

BTW, two nested If() functions would look loke this:

[color:blue]If ( test1 ; result1 ; [color:red]If ( test2 ; result2 ; defaultResult ) [color:blue])

Edited by Guest
Link to comment
Share on other sites

I would use a Case Statement

Not sure if the results are what you are looking for, but this calculation

Case ( Appointment Type = "C" and Total Time > 1; 0 ; Appointment Type)

Produces a 0 if both conditions are met, and sets it to the Appointment Type if not.

Lee

Link to comment
Share on other sites

I would use a Case Statement

Not sure if the results are what you are looking for, but this calculation

Case ( Appointment Type = "C" and Total Time > 1; 0 ; Appointment Type)

Produces a 0 if both conditions are met, and sets it to the Appointment Type if not.

Lee

This works great! One last thing that I just noticed. I need appointment type to be either C OR S. I tried this but it doesn't seem to work.

Case ( Appointment Type = "C" or "S" and Total TIme > 1 ;"O" ; Appointment Type )

Link to comment
Share on other sites

How about:

Case ( Appointment Type = "C" and Total Time > 1; 0; Appointment Type = "S" and Total Time > 1 ; 0 ; Appointment Type)

Lee

Edited by Guest
removed the second calc, did hold up
Link to comment
Share on other sites

This topic is 4983 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.