+ Reply to Thread
Results 1 to 10 of 10

Counting the number of hours within weekdays.

  1. #1
    Registered User
    Join Date
    05-26-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2013
    Posts
    4

    Counting the number of hours within weekdays.

    Hello, Please help! I believe I figured out how to obtain the number of entries for the day of the week =SUMPRODUCT(--(WEEKDAY(C$2:C$23)=1)) for Sunday and so on....

    I also need to know how many entries occur during that weekday at a certain time. For example, from the data I need to know how many entries occurred on a Monday at 9 am.

    Attached is sample data due to privacy.

    Thanks in advance.

    Robert
    Attached Files Attached Files

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Counting the number of hours within weekdays.

    Try the below for total for all weekday at a specific time
    =sumproduct((weekday(c2:c23,2)<=5)*(mod(c2:c23,1)=time(9,0,0)))

    for particular week day
    for monday
    =sumproduct((weekday(c2:c23,2)=1)*(mod(c2:c23,1)=time(9,0,0)))
    for tuesday
    =sumproduct((weekday(c2:c23,2)=2)*(mod(c2:c23,1)=time(9,0,0)))
    etc.,
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Counting the number of hours within weekdays.

    With an pivot table.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    05-26-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2013
    Posts
    4

    Re: Counting the number of hours within weekdays.

    Hello,

    Thank you so much for your reply.

    To be clear, the formula below I only change the number in bold for the days of the week?

    =sumproduct((weekday(c2:c23,2)=1)*(mod(c2:c23,1)=time(9,0,0)))

    Is it posible to have the formula show a range of time? Such as 9:00 am to 9:59am?

    Thanks

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Counting the number of hours within weekdays.

    Please Login or Register  to view this content.
    The anwer on that question is YES.

    For the second question,
    1) make a helpcolumn to determine the time.
    2) make a helpcolumn to determine the range (9:00 am to 9:59am).
    3) After that you can use pivot table or sumproduct.

    For 2) I would make a table with the excpected ranges and use VLookup to find the description (in that table).

  6. #6
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Counting the number of hours within weekdays.

    To show a range of time from 9:00 AM to just before 10:00 AM, change...
    (mod(c2:c23,1)=time(9,0,0))
    ...to...
    (INT(mod(c2:c23,1)*24)/24=time(9,0,0))

  7. #7
    Registered User
    Join Date
    05-26-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2013
    Posts
    4

    Re: Counting the number of hours within weekdays.

    Hello,

    Do the formulas below indicate the correct day of the week?

    monday =SUMPRODUCT((WEEKDAY($L$2:$L$2162,2)=1)*(INT(MOD($L$2:$L$2162,1)*24)/24=TIME(7,0,0)))
    .....
    sunday =SUMPRODUCT((WEEKDAY($L$2:$L$2162,2)=7)*(INT(MOD($L$2:$L$2162,1)*24)/24=TIME(7,0,0)))

    Thanks!

    Robert

  8. #8
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Counting the number of hours within weekdays.

    Yes.......

  9. #9
    Registered User
    Join Date
    05-26-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2013
    Posts
    4

    Re: Counting the number of hours within weekdays.

    thank you all so much!!! I really appreciate your help.

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Counting the number of hours within weekdays.

    If your time range is a whole hour then it might be easier to use HOUR function, e.g. for Sunday between 07:00 and 07:59:59 inclusive

    =SUMPRODUCT((WEEKDAY(C2:C23)=1)*(HOUR(C2:C23)=7))
    Audere est facere

+ 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. Replies: 2
    Last Post: 11-12-2014, 11:56 AM
  2. Average Values Based on Weekdays and Business Hours Only
    By Shoulder_Devil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-29-2014, 02:25 PM
  3. Counting weekdays
    By oldbob in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-13-2012, 05:36 AM
  4. Counting number of weekdays to a future date
    By BrianJC in forum Excel General
    Replies: 1
    Last Post: 01-09-2012, 03:09 PM
  5. Counting Weekdays
    By kmrkmj in forum Excel General
    Replies: 3
    Last Post: 07-17-2007, 05:22 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