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.
jph826Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

vastoCommented:
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

Open in new window


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
)

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

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

Start your 7-day free trial
mlmccCommented:
I agree.  I think vasto has your solution.  If that is not correct tell us in English what it should do.

mlmcc
James0628Commented:
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 ])

Open in new window


 James
jph826Author 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?
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.