1

I hope, someone can help me finding the error. I am working on a form in SharePoint to enter the working time. Calculating the working time without lunch is no problem, but I am running in Errors when including the Lunch time.

I have a choice-menu, where I can choose, how long the lunch time was (30 minutes, 45 minutes, 60 minutes, no lunch).

The columns are "WorkingTime", "LunchTime", "EndTime" and "StartTime".

My calculated column looks like below:

=IF([LunchTime]="No Lunch",((EndTime-StartTime)*24),
IF([LunchTime]="30 Minutes",((EndTime-StartTime)*24)-0.5),
IF([LunchTime]="45 Minutes",((EndTime-StartTime)*24)-0.75),
IF([LunchTime]="60 Minutes",((EndTime-StartTime)*24)-1))))

Can somebody tell me, where the error is?

Thank you in advance, Best Regards Jochen

2

Always format you formulas in a Text Editor with line breaks,
and you immediatly see where you go wrong with the brackets:

=IF([LunchTime]="No Lunch"
    ,((EndTime-StartTime)*24)
    ,IF([LunchTime]="30 Minutes"
        ,((EndTime-StartTime)*24)-0.5
       )
    ,IF([LunchTime]="45 Minutes"
        ,((EndTime-StartTime)*24)-0.75
       )
    ,IF([LunchTime]="60 Minutes"
        ,((EndTime-StartTime)*24)-1
       )
  )))

You might want to do:

=(EndTime-StartTime)*24 -
    IF([LunchTime]="30 Minutes"
        ,0.5
        ,IF([LunchTime]="45 Minutes"
            ,0.75
            ,IF([LunchTime]="60 Minutes"
                ,1
                ,0
               )
           )
      )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.