+ Reply to Thread
Results 1 to 7 of 7

Formula to calculate total time spent per person based on data from multiple sheets

  1. #1
    Registered User
    Join Date
    05-09-2017
    Location
    Edmonton, Alberta
    MS-Off Ver
    2016
    Posts
    61

    Formula to calculate total time spent per person based on data from multiple sheets

    Hello,
    I have a several workbooks with multiple sheets. Each workbook is for a different date range and each sheet in each workbook represents a different date. On the sheets is the amount of time spent per person for that day.
    I need to do a summary of the total amount of time spent per person across all the workbooks and sheets. Please see attached example.

    So Column B on the 'Summary' sheet should pull data from sheet 'Day 1' and 'Day 2'. I would like the formula in B2 on the Summary sheet to look for 'Steve Rogers' in column A in 'Day 1' and 'Day 2' and where it finds 'Steve Rogers' it should pull the totals from column D and add the together.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-22-2018
    Location
    Blackpool, England
    MS-Off Ver
    2019
    Posts
    408

    Re: Formula to calculate total time spent per person based on data from multiple sheets

    If you put this in B2 on the Summary worksheet and copy down, I think it'll do what you want
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    HTH
    Tim


    EDIT: If you put this in Summary!A1 and copy it down, it'll populate automatically with a distinct list, too.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This is an ARRAY formula, so you need to use [CTRL]+[SHIFT]+[ENTER] to input it
    Last edited by harrisonland; 04-03-2020 at 01:38 PM.
    Never stop learning!
    <--- please consider *-ing !

  3. #3
    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,929

    Re: Formula to calculate total time spent per person based on data from multiple sheets

    I think you are making this far more complex that it needs to be. Unless each sheet contains 1000's of rows of data, you will probably be better served to have ALL data on 1 single sheet (all in 1 WB), then run your summaries from that
    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

  4. #4
    Registered User
    Join Date
    05-09-2017
    Location
    Edmonton, Alberta
    MS-Off Ver
    2016
    Posts
    61

    Re: Formula to calculate total time spent per person based on data from multiple sheets

    Thank you, I'm realizing though that my formatting may need to be adjusted as well. I've set the Total columns on all sheets to custom (hh:mm), but the result I'm getting is a time rather than a number so if I'm then calculating a total payment from the 'Summary' Colmn B data then it doesn't calculate correctly.
    For example Steve Rogers time should add up to 10.5 hours, which it is, but what I multiply by the hourly rate of $10/hr I'm getting $4.38, when it should be $105.00
    I've updated the attachment to reflect.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-09-2017
    Location
    Edmonton, Alberta
    MS-Off Ver
    2016
    Posts
    61

    Re: Formula to calculate total time spent per person based on data from multiple sheets

    Yes that's possible, but it's not my data and that's how the data owners want it saved/sorted.

  6. #6
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Formula to calculate total time spent per person based on data from multiple sheets

    I created a named range (Days) that lists all day tabs from cell K2 (Day 1 & Day 2 in your example sheet. List the other day tabs below K3
    and, in the Formula ribbon, use name manager to adjust range properly in the Refers to box.

    Then I use this formula to SUMIF from all day tabs.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Finally, the correct formula in E2 should be:
    =$D$2*B2*24

    Please check file attached.

    Good luck!
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    06-22-2018
    Location
    Blackpool, England
    MS-Off Ver
    2019
    Posts
    408

    Re: Formula to calculate total time spent per person based on data from multiple sheets

    Just to add to what Estvaoba said... Remember that Excel stores times as fractions of one day, that's why the correct formula in E2 is as above (i.e. "* 24")

    Another thing to note, your custom "time" format won't display properly if there are more than 24 accumulated hours. To get round that, use the custom format "[hh]:mm". You'll notice that "Iron Man" suddenly has 24 hours accumulated time - not zero. It won't make a difference to the calculated "Total Pay", but it will make sense to anyone looking at the figures and wondering why Iron Man gets charged for 24 hours' viewing, rather than none.

    Tim
    Last edited by harrisonland; 04-03-2020 at 04:44 PM.

+ 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. [SOLVED] Calculate time based on 2 different rows for specific person/date
    By ricer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-21-2019, 10:30 AM
  2. Total time spent over a term where monthly time reduces
    By dave0109 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-14-2019, 07:13 AM
  3. Replies: 0
    Last Post: 03-04-2016, 06:38 PM
  4. Replies: 2
    Last Post: 09-11-2014, 11:06 AM
  5. Replies: 3
    Last Post: 03-06-2014, 12:48 AM
  6. Replies: 3
    Last Post: 12-19-2013, 06:49 AM
  7. How can I calculate amount of time left based on amount spent?
    By KLD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-23-2006, 11:25 AM

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