• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Calculation of total hours worked

Preston

New Member
Hi. First of all, I have cross-posted the question below because it pertains to my job. Here are links to the other places that I've posted it:

http://www.mrexcel.com/forum/excel-...lculation-total-hours-worked-please-help.html

http://www.excelguru.ca/forums/show...lculation-of-total-hours-worked-(PLEASE-HELP)

http://www.excelforum.com/excel-for...lation-of-total-hours-worked-please-help.html

http://www.msofficeforums.com/excel/31092-complicated-calculation-hours-worked.html

Anyway, here is the question:

I have a spreadsheet that shows the amount of time that somebody worked over the course of several years. The spreadsheet is about 30,000 rows long and very poorly organized (more on this below). I need to calculate the hours worked by this individual each day over the course of all the years shown on the spreadsheet, but there are NOT separate columns for time clocked in and time clocked out. If there were separate columns for those values, I could calculate the total hours worked on the first day/row, and then I could drag the formula down the entire spreadsheet.

Unfortunately, as I said, there are not separate columns for the clock-in and clock-out times. Instead there is one column for both times. To make matters worse, the column that shows times does not only show time clocked in and time clocked out; it also shows the times at which various work tasks were performed throughout the day (between the clock-in and clock-out times).

Anyway, my boss wants me to figure out the total number of work hours recorded on the spreadsheet, and I have no idea how to proceed. The column that shows times (clocked in, clocked out, etc.) is right next to a column that shows the date (which is entered as a number rather than a date). Also, the date is written in the format YYYYMMDD, just to make things more confusing. So this is what the spreadsheet looks like:

DATE | TIME | ACTIVITY
20080507 | 9:30 | work task #1 (i.e. clock-in time)
20080507 | 11:30 | work task #2
20080507 | 2:30 | work task #3
20080507 | 4:30 | final work task (i.e. clock-out time)
20080508 | 9:30 | work task #1 (i.e. clock-in time)
20080508 | 11:30 | work task #2
20080508 | 2:30 | work task #3
20080508 | 4:30 | final work task (i.e. clock-out time)
20080509 | 9:30 | work task #1 (i.e. clock-in time)
20080509 | 11:30 | work task #2
20080509 | 2:30 | work task #3
20080509 | 4:30 | final work task (i.e. clock-out time)

(NOTE: The actual spreadsheet contains extreme variation between the days in terms of the hours worked on each day. Also, the terms "clock-in" and "clock-out" are NOT actually present anywhere in the spreadsheet. Thus, the stuff that appears in the Activity column is totally inconsistent and not very helpful in constructing a formula.)

Anyway, given the strange format of this spreadsheet, I have no idea how to automatically calculate the total hours worked down the entire spreadsheet. The only thing that I can do is create formulas for each day (one day at a time) and then add up all the hours once I've calculated them day-by-day. The process would take months, which is too long for the demands of my boss. By the way, I have to do this for 7 other spreadsheets that are also about 30,000 rows long.

Is there any way to create formulas that can 1) divide the rows into segments based on the DATE values 2) automatically calculate the total time elapsed within each segment/day (using the first and last time values for each segment/day, which would represent, respectively, time clocked-in and time clocked-out)?

As you can see, this problem far exceeds my Excel capabilities. I truly appreciate any and all help that you guys can offer. Thank you.
 
Hi ,

1. Please go through all the posts in response to your question on the other forums , and then confirm that your problem is still unresolved.

2. Upload a workbook with data in it ; even if you cannot upload the original file with 30000 rows of data , please upload a file with at least two months of data.

Narayan
 
Preston

Firstly, Welcome to the Chandoo.org Forums


I would setup a Table of Dates down the side and Check In (Minimum) and Check Out (Maximum) across the top

Then I would use a Sumproduct() or Sum(If()) function to retrieve the Minimum Date/Time and Maximum Date/Time for each day

Then I would add a column to calculate the work hrs

Then Report via a Pivit table I think

What I suggest you do is to post a sample file with say 20 or 30 records
Then we can give a more targeted answer.
 
Thank you for your responses, gentlemen.

I have attached the first half of the spreadsheet (rows 1-15,000) for your reference. I removed the "Activity" column because it's technically private information in addition to not really being helpful.

(I haven't quite gotten a full solution from any of the other forums yet.)

Thank you so much for your time.
 

Attachments

  • APreston Spreadsheet.xlsx
    324.5 KB · Views: 5
Please see a solution attached:
upload_2016-5-10_12-35-41.png
Work from Left to right and each column should be self explanatory

If this isn;t what you after please elaborate

[Edit] Updated with p45cal's comments below
 

Attachments

  • APreston Spreadsheet2.xlsx
    726 KB · Views: 9
Last edited:
Hello again. First of all, I'm sorry for not adding the additional links.

Anyway, thank you, everyone, for your time and generosity. I'll follow up if there are any additional concerns.
 
Narayan and Hui,

Wow. Great stuff. Thank you, thank you, thank you. :)

I have to concede that I posted this question in too many forums and probably took up more people's time than was necessary. That was discourteous, so I apologize.
 
Please advise all the other forums that the solution has been found

In future please post a question and then check back regularly
98% of posts are answered within the first hour here
 
Back
Top