You are here:

# Excel/Time interval question

Question
I have a real brain buster for you. Sorry for crushing your brain in advanced. I have a list of 45 employees. I am allowed to export their time punches. Normally four punches per day, sometimes two punches. I would like to make a formula that tells me how many hours an employee worked, I would also like to see who has taken a break that is greater than 30 minutes. The export looks like this.
Emp ID  Date
51817   5/18/2015 3:00   ON
51817   5/18/2015 8:00   OF
51817    5/18/2015 8:30   ON
51817   5/18/2015 13:30   OF
51833   5/18/2015 4:56   ON
51833   5/18/2015 12:21   OF
51833   5/18/2015 12:59   ON
51833   5/19/2015 3:30  OF
51838   5/18/2015 18:49   ON
51838   5/18/2015 4:59   OF

I think your last one in the list should be 5/19/2015 4:59, not 5/18.

Assuming the first "ON" is in cell C2, then put these formulas in:
D3, fill down to D11 (D2 blank): =IF(A3<>A2,0,24*(B3-B2))
E3, fill down to E11 (E2 Blank): =IF(D3=0,0,E2+D3)
F3, fill down to F11 (F2 blank): =IF(D4=0,E3,"")

Column D is the time of the breaks.
Column E should be hidden and is a running total of D
Column F shows the total for each Emp ID at the end of the Emp ID list.

Select D3:D11, use conditional formatting with this formula: =AND(C2="ON",D2>0.5) and make any color you want. When you see the color, then the break was over 30 minutes.

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Bob Umlas

##### Expertise

I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at http://www.thumbtack.com/ny/new-york/excel-training/

##### Experience

Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Publications
Excellence, The Expert, Microsoft

Education/Credentials
BA in math, Hofstra University, 1965

Awards and Honors
MVP
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks