Re: How to calulate hours worked on Sundays in a specific month

KyleOliver

New Member
Joined
Apr 16, 2016
Messages
31
Re: How to calulate hours worked on Sundays in a specific month

Hi,

I would like to know how to add all hours worked on the sundays in a month.
An employee might not work every Sunday in a month. Some employees will work one Sunday, others might work 2 or more and some might not work any Sundays in a month.

My table looks as follows;

<strike></strike><strike></strike>[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[TD="align: center"]G[/TD]
[TD="align: center"]H[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Week Day<strike></strike>[/TD]
[TD]<strike></strike>Punch Date<strike></strike>[/TD]
[TD]<strike></strike>Time In<strike></strike>[/TD]
[TD]<strike></strike>Lunch Start<strike></strike>[/TD]
[TD]<strike></strike>Lunch End<strike></strike>[/TD]
[TD]<strike></strike>Time Out<strike></strike>[/TD]
[TD]<strike></strike>Hours Worked<strike></strike>[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Monday[/TD]
[TD]01 Aug 2018[/TD]
[TD]08:00[/TD]
[TD]12:00[/TD]
[TD]13:00[/TD]
[TD]16:00[/TD]
[TD]7:00[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Tuesday[/TD]
[TD]02 Aug 2018[/TD]
[TD]
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Wednesday[/TD]
[TD]
03 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Thursday[/TD]
[TD]
04 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Friday[/TD]
[TD]
05 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Saturday[/TD]
[TD]
06 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Sunday[/TD]
[TD]
07 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Monday[/TD]
[TD]
08 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Tuesday[/TD]
[TD]
09 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]Wednesday[/TD]
[TD]
10 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]Thursday[/TD]
[TD]
11 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]Friday[/TD]
[TD]
12 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]Saturday[/TD]
[TD]
13 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]Sunday[/TD]
[TD]
14 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]Monday[/TD]
[TD]
15 Aug 2018
<strike></strike>[/TD]
[TD]<strike></strike>
08:00
<strike></strike>[/TD]
[TD]<strike></strike>
12:00
<strike></strike>[/TD]
[TD]<strike></strike>
13:00
<strike></strike>[/TD]
[TD]<strike></strike>
16:00
<strike></strike>[/TD]
[TD]<strike></strike>
7:00
<strike></strike>[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
How do I calculate just the hours worked on a Sunday?
Do I use a SUMIF / SUMIFS / SUMPRODUCT / MATCH / INDEX?

I have no idea, please someone help?

:confused:

Regards,
Kyle
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Re: How to calulate hours worked on Sundays in a specific month

Try

=SUMPRODUCT((B2:B16="Sunday")*(H2:H16))

Do you know that instead of day name you could use date and make the calculation per month
 
Last edited:
Upvote 0
Re: How to calulate hours worked on Sundays in a specific month

Let's assume that in column C there is some Excel date like dd/mm/yyyy
Next formula wil give the hours sum =SUMPRODUCT((WEEKDAY(C2:C16;2)=7)*(MONTH(C2:C16)=8)*(H2:H16))

in column B put = column C with a custom format like dddd it gives the weekday day
 
Upvote 0
Re: How to calulate hours worked on Sundays in a specific month

Hi PCL,

Thank-you for your response.

I used the following formula which worked;

=SUMPRODUCT((TEXT(B16:B46,"ddd")=TEXT(F13,"ddd"))*H16:H46)

Thanks for your willingness to assist a novice like me.

Regards,
Kyle
 
Upvote 0
Re: How to calulate hours worked on Sundays in a specific month

Your example shows incorrect weekdays.
Ensure the formula separators are correct for your region.


Excel 2010
ABCDEFGH
11Week DayPunch DateTime InLunch StartLunch EndTime OutHours Worked
22WednesdayWed 01-Aug-188:0012:0013:0016:007:00
33ThursdayThu 02-Aug-188:0012:0013:0016:007:00
44FridayFri 03-Aug-188:0012:0013:0016:007:00
55SaturdaySat 04-Aug-188:0012:0013:0016:007:00
66SundaySun 05-Aug-188:0012:0013:0016:007:00
77MondayMon 06-Aug-188:0012:0013:0016:007:00
88TuesdayTue 07-Aug-188:0012:0013:0016:007:00
99WednesdayWed 08-Aug-188:0012:0013:0016:007:00
1010ThursdayThu 09-Aug-188:0012:0013:0016:007:00
1111FridayFri 10-Aug-188:0012:0013:0016:007:00
1212SaturdaySat 11-Aug-188:0012:0013:0016:007:00
1313SundaySun 12-Aug-188:0012:0013:0016:007:00
1414MondayMon 13-Aug-188:0012:0013:0016:007:00
1515TuesdayTue 14-Aug-18
1616WednesdayWed 15-Aug-188:0012:0013:0016:007:00
17
18
19Sunday14:00:00
20Sunday14:00:00
2114:00:00
2214:00:00
2314:00:00
24714:00:00
2a
Cell Formulas
RangeFormula
B19=SUMPRODUCT(--(B2:B16="Sunday"),(H2:H16))
B20=SUMPRODUCT(--(B2:B16=A20),(H2:H16))
B21=SUMPRODUCT((WEEKDAY(C2:C16,2)=7)*(MONTH(C2:C16)=8)*(H2:H16))
B22=SUMPRODUCT(--(WEEKDAY(C2:C16,2)=7),--(MONTH(C2:C16)=8),(H2:H16))
B23=SUMPRODUCT(--(WEEKDAY(C2:C16,2)=7),(H2:H16))
B24=SUMPRODUCT(--(WEEKDAY(C3:C18,2)=A24),(H3:H18))
 
Last edited:
Upvote 0
Re: How to calulate hours worked on Sundays in a specific month

Your formula edited


Excel 2010
BCDEF
2514:00:00Sun 05-Aug-18
2614:00:00
2a
Cell Formulas
RangeFormula
B25=SUMPRODUCT(--(TEXT(C2:C16,"ddd")="Sun"),(H2:H16))
B26=SUMPRODUCT(--(TEXT(C2:C16,"ddd")=TEXT(F25,"ddd")),(H2:H16))
 
Upvote 0
Re: How to calulate hours worked on Sundays in a specific month

Thanks Dave,

Your formula is working great. Much appreciated!

Regards,
Kyle
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top