# Crystal formula returning "the remaining text does not appear to be part of the formula" why?

Issue with this Crystal reports formula:

if {BENEFIT.PLAN_CODE} = "LTD2" and
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60 > 120000 then 120000 else
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60  else

if {BENEFIT.PLAN_CODE} = "LTD3" and
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667 > 120000 then 120000 else
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667

is returning "the remaining text does not appear to be part of the formula.  The hi-light is from the second "else" to the end of the formula.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
You cannot have 2 else

``````if {BENEFIT.PLAN_CODE} = "LTD2" and  -int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60 >120000 then
120000

else
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60

else  if {BENEFIT.PLAN_CODE} = "LTD3" and
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667 > 120000 then 120000 else
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667
``````

The second else, which is on the line "else  if {BENEFIT.PLAN_CODE} = "LTD3" and  " is braking the syntax because there is no staring if-then

It seems that your formula should look something like this
``````if {BENEFIT.PLAN_CODE} = "LTD2" then
(
if -int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60 >120000 then
120000
else
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60
)
else  if {BENEFIT.PLAN_CODE} = "LTD3" then
(
if -int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667 > 120000 then
120000
else
-int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667
)
``````
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
I agree.  I think vasto has your solution.  If that is not correct tell us in English what it should do.

mlmcc
0
Commented:
I agree with the others.  Technically, I don't think the ()'s in vasto's solution are required, but they may help you see how the logic works.

FWIW, I think you could also rewrite your formula like this:

``````if {BENEFIT.PLAN_CODE} = "LTD2" then
Minimum ([ -int(-({PAEMPLOYEE.BEN_SALARY_3}/1000))*1000 * .60, 120000 ])
else
if {BENEFIT.PLAN_CODE} = "LTD3" then
Minimum ([ -int(-({PAEMPLOYEE.BEN_SALARY_3}/1))*1 * .6667, 120000 ])
``````

James
0
Author Commented:
I would like to close out this question accepting vasto's solution, however; there is no link in the solution for me to accept and award points. Can you do this or advise on how I can close this out please?
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.