+ Reply to Thread
Results 1 to 14 of 14

Sum of only monthly hours

  1. #1
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Sum of only monthly hours

    Hi,

    I need formula help in attached report.

    I wanted formula in "Total Hours" column (row B6 & C6) which sum the weekly hours for that month from the "Hours" column (row B3 to D3).

    The issue is that if week end in next month then formula should divide the hours as per the days in that month.

    In attached report last week ended in 03rd Aug so in July month I need total for 20 + 30 + 24 ( last 3 days of July) and remaining 16 hours in the month of Aug.

    Assumption: Daily 8 hours and week Monday - Friday.

    Thanks,
    Rahul
    Attached Files Attached Files
    Last edited by rchure; 07-25-2019 at 08:52 AM.

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Sum of only monthly hours

    week Monday - Friday
    if so
    wtat these dates mean?: 16.07.2019 29.07.2019

  3. #3
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Sum of only monthly hours

    This is a random date I have included because employee join in any day of month.

  4. #4
    Registered User
    Join Date
    07-13-2019
    Location
    Mansehra, Pakistan
    MS-Off Ver
    2010
    Posts
    46

    Re: Sum of only monthly hours

    Assuming that From 16/07/2019 to 29/07/2019 as in your example, and From 01/08/2019 to 03/08/2019.

    Use the function Networkdays and multiply it by 8 hours per day in the same formula, you will have 96 hours in total for July through 3 aug, 2019.

    Hope its solved, let me know if its not...

    Solved file is attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-18-2017
    Location
    United States
    MS-Off Ver
    2016
    Posts
    5

    Re: Sum of only monthly hours

    Here's another suggestion. Create a table that reviews the date of the week and allocates a percentage of the total hours to each month given the day in the date. Once allocated, multiple each month by the percent allocation in order to get a total hours for each month. Then create a separate table to sum the hours per month using sumif formula. Details below. I tried to upload a workbook as well so hopefully it came through.

    Create Table 1 per details below. I've named each column and then used the name in the formulas

    Column 1: Week
    Column 2: Hours
    Column 3: Month 1 (formula is =MONTH((Week)
    Column 4: Month 1 Allocation (formula is =IF(DAY(Week)>7,1,DAY(Week)/5))
    Column 5: Month 2 (formula is =IF(Month 1 Allocation=1,"",MONTH(Week)-1)
    Column 6: Month 2 Allocation (formula is =IF(Month 1 Allocation=1,0,1-Month 1 Allocation)
    Column 7: Month 1 Total (formula is =Hours*Month 1 Allocation
    Column 8: Month 2 Total (formula is =Hours*Month 2 Allocation

    Now create your output (Table 2)
    Column 1: Month (manual input with a number for the month. So for this example, Row 1 would be "7" for July and Row 2 would be "8" for August. In the next formula, J9 is
    Column 2: =SUM(SUMIF(Table1 (Month 1),Month,Table1(Month 1 Total),(SUMIF(Table1(Month 2),Month,Table1(Month 2 Total))))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Sum of only monthly hours

    Thanks for the reply.

    The 8 hours not fixed every day because people take leave. The problem is only last week of month because some days go to next month.

    So whatever hours in last it will divide by 5 days and split in months.

  7. #7
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Sum of only monthly hours

    Hi Oniwlmh,

    Thanks for the reply.

    I can't include more table in report because I just give example of 3 weeks but in originally I have multiple weeks so its very time consuming to include this extra table.

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,554

    Re: Sum of only monthly hours

    Perhaps if Oniwlmh's extra table filled automatically from the data in D2:F3 it would help.
    1. Week: =INDEX(B$2:D$2,ROWS(A$1:A1))
    2. Hours: =INDEX(B$3:D$3,ROWS(A$1:A1))
    3. Month 1: =IF(DAY([@Week])>=5,MONTH([@Week]),MONTH([@Week])-1)
    4. Month 1 Allocation: =IF(DAY([@Week])>=5,1,1-DAY([@Week])/5)
    5. Month 2: =IF([@[Month 1 Allocation]]=1,"",MONTH([@Week]))
    6. Month 2 Allocation: =IF([@[Month 1 Allocation]]=1,0,1-[@[Month 1 Allocation]])
    7. Month 1 Totals and Month 2 Totals are not changed.
    8. The original Total Hours cells (B6:C6) are populated using: =SUM(Table1[Month 1 Total])
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Sum of only monthly hours

    Please try at B6

    =SUM(--TEXT(NETWORKDAYS(IF($B$2:$D$2-6<B5,B5,$B$2:$D$2-6),IF($B$2:$D$2>EOMONTH(B5,0),EOMONTH(B5,0),$B$2:$D$2))/5*$B$3:$D$3,"0;\0;0"))

    Press Ctrl+Shift+Enter and drag to C6
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Sum of only monthly hours

    Thank You Bo_Ry the formula working perfectly..

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Sum of only monthly hours

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Sum of only monthly hours

    Thanks JeteMc for the help.

    Below "Bo_Ry" formula working perfectly. I will get back to you if I faced any issues.

  13. #13
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,554

    Re: Sum of only monthly hours

    You're Welcome and thank you for the feedback. I hope that you have a blessed day.

  14. #14
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Sum of only monthly hours

    create new post.
    Last edited by rchure; 07-25-2019 at 08:58 AM.

+ 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. Monthly Hours Tracking
    By momoneymath in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-26-2016, 04:34 PM
  2. Replies: 5
    Last Post: 06-30-2016, 08:37 AM
  3. Replies: 1
    Last Post: 06-29-2016, 08:56 AM
  4. Help Please...!! How To Separate Regular & Overtime Hours From Total Monthly Hours
    By iffyxalone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2016, 08:55 AM
  5. Replies: 1
    Last Post: 06-29-2016, 08:55 AM
  6. Calculate daily hours but save as monthly and yearly hours each day
    By auzgts in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-17-2014, 06:14 AM
  7. [SOLVED] How do I set up monthly random work schedule for 60 hours monthly
    By The Ace of the Base in forum Excel General
    Replies: 0
    Last Post: 04-04-2006, 02:40 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