+ Reply to Thread
Results 1 to 9 of 9

Silly question about averaging times in excel

  1. #1
    Forum Contributor
    Join Date
    05-12-2014
    MS-Off Ver
    Excel 2013
    Posts
    131

    Silly question about averaging times in excel

    Howdy!

    I'm doing a study for my job where I had people track how long it takes them to do certain tasks each day. I set up a macro to record a start and end time, and then put a cell on the worksheet they were using to subtract the start time from the end time. Here's an example since I can't share the actual worksheet:

    Start Time End Time Total Time
    10:31 am 10:37 am 06:00
    10:55 am 11:05 am 10:00
    11:07 am 11:15 am 08:00

    So you can see, it's nothing too fancy. Because of the scope of the project, there are some people who had upwards of 1k+ lines of data to track. So!
    What I did was make a formula that added up the times by task.

    Here's an example:
    Task Name Total Time
    Sweeping 01:51:01

    So there's 1 hour, 51 minutes, and 1 second worth of task time after adding it all up. Then, I try to divide by the number of times the task was performed (40, in this instance), and that's when things get kooky.

    The actual answer should be somewhere in the neighborhood of 2 minutes and change, but no matter what I try (formatting as [h]:mm, mm:ss, formatting as a number, formatting as [m]:ss, multiplying various items by 1440, dividing by 60, etc), I never get the right answer. I usually get 14:47, which is 12 minutes too high.

    So the super short version of this question would be, how can I take a total sum of time ranges for tasks, then divide that sum by the number of times the tasks were performed to get the correct answer?

    It's probably something comically easy that I'm missing, but 2 hours in and I'm ready to throw something. Any help would be appreciated!

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Silly question about averaging times in excel

    Have you tried using AVERAGEIFS() ?

    BSB

  3. #3
    Forum Contributor
    Join Date
    05-12-2014
    MS-Off Ver
    Excel 2013
    Posts
    131

    Re: Silly question about averaging times in excel

    Quote Originally Posted by BadlySpelledBuoy View Post
    Have you tried using AVERAGEIFS() ?

    BSB
    Yup! That was what I tried first, actually. Here's a screenshot for reference (using AVERAGEIFS)
    Capture1.JPG

    The formula up top is:
    Please Login or Register  to view this content.
    If I take that result (19:14:47) and divide it by the next cell (40), it's closer to the correct answer, but still wrong.
    It spits out a result of a 4:52 average, but I know for a fact it's 2 minutes and 50 some odd seconds. So I'm not sure where I'm gumming up the works.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Silly question about averaging times in excel

    Hi,

    See if the example problem does what I think you want. I've used a Pivot Table instead of a formula to do the work.

    Time Worked per Task Average PT.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Silly question about averaging times in excel

    I cannot replicate the issue you're seeing. If I divide 1:51:01 by 40 I get 0:02:47, whichever way I do it.
    I think we are going to need to see the workbook. Desensitized to protect sensitive data.

    BSB

  6. #6
    Forum Contributor
    Join Date
    05-12-2014
    MS-Off Ver
    Excel 2013
    Posts
    131

    Re: Silly question about averaging times in excel

    Marvin, that PivotTable looks like it'd do what I want, but sadly I have 0 experience with PivotTables. I should probably remedy that...

    BSB, attached is a dummy worksheet. Same error, 4:52 in the highlighted blue area under AL.

    I have a strong feeling I'm gonna feel like an idiot when it gets pointed out what I'm doing wrong...
    Attached Files Attached Files

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Silly question about averaging times in excel

    I think I have found the problem. Many of your times also include a date - look at C6 for instance. This results in C6-B6 being 42471.0022800926 instead of 0.00228009259412326

    Try this fix for the calc...
    =MOD(C1,1)-MOD(B1,1)

    Then use this for the calcs...
    =AVERAGEIFS($D$1:$D$945,$A$1:$A$945,F1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Forum Contributor
    Join Date
    05-12-2014
    MS-Off Ver
    Excel 2013
    Posts
    131

    Re: Silly question about averaging times in excel

    Quote Originally Posted by FDibbins View Post
    I think I have found the problem. Many of your times also include a date - look at C6 for instance. This results in C6-B6 being 42471.0022800926 instead of 0.00228009259412326

    Try this fix for the calc...
    =MOD(C1,1)-MOD(B1,1)

    Then use this for the calcs...
    =AVERAGEIFS($D$1:$D$945,$A$1:$A$945,F1)
    It worked! Thank you so much, that was amazing! Rep for you good sir!

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Silly question about averaging times in excel

    Awesome, glad you got this resolved, and thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Silly Excel Formula Question (having a brain freeze moment)
    By rjw524 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2015, 02:46 PM
  2. [SOLVED] Silly Question !!
    By DanielRay in forum The Water Cooler
    Replies: 4
    Last Post: 12-08-2012, 04:49 PM
  3. Silly Question !!
    By DanielRay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-07-2012, 11:41 AM
  4. silly look up question
    By floricita in forum Excel General
    Replies: 1
    Last Post: 10-11-2010, 07:03 AM
  5. [SOLVED] [SOLVED] What a silly question !
    By tom in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-22-2006, 06:15 AM
  6. Silly question from a new excel user
    By writingirl007 in forum Excel General
    Replies: 0
    Last Post: 01-13-2005, 11:38 AM
  7. Adding/Averaging Times in Excel
    By JD in forum Excel General
    Replies: 3
    Last Post: 01-05-2005, 02:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1