Search code examples
excelexcel-formularoundingworksheet-functiontime-format

Replace "Lunch Out, Lunch In" with duration in formula to give Time Out/In difference excluding Lunch


I currently have the following formula to track my work schedule. Time is put down in traditional format ie. 8:00 am, and is then totaled to show hours worked as a whole number 8, for 8 hrs worked:

=IF(D2="","",ROUND(IF(OR(C2="",B2=""),(D2-A2),(B2-A2)+(D2-C2))*24*4,0)/4)

A=Time In , B=Lunch Out , C=Lunch In , D=Time Out.

I would like to alter this to in two ways:

1st. Remove the ROUND function, I don't need it.

2nd. I don't need Lunch In and Lunch Out. I need column B to =Lunch, displayed as a number (1 for one hour or, .5 for half hour) to be subtracted from Time In and Time Out since we're not paid for lunch.


Solution

  • Adding a ColumnE for Lunch, please try:

    =IFERROR(IF(D2="","",(D2-A2)*24)-E2,"")
    

    formatted as number.