information provided by dates

jwgreen1986

Board Regular
Joined
Mar 8, 2019
Messages
64
ill try to keep this simple. basically i have a start date and an end date of an employee.

the first thing i want to do is work out how many days a person has worked over a quarter. so i need something that will work out how many days there are in jan feb and mar and add these together. then do the same for apr may jun and so on.

next i want to look at a persons start date and work out how many of the days they have worked in a quarter. for example, if they started on 5th feb there pro rate would be 23+31 which equals 54 days out of 89 (jan - mar).
i would also like to do the same but with an end date. so if someone leaves the company id like to know how many days they have worked before they have left.

the next thing i would like to do is populate some month fields. so i would have the 3 months of the quarter listed. then looking at their start date and end date i would like to simply put yes or no in the month cell for each employee as to whether or not they were working for the company in said month. for example if an employee started working in the company on 17th feb they would have no in jan but yes in feb and mar. again i would then like to do the same for leaving date.

this has really got me stumped. im trying to think of formulas i can use but can think of any. is there a simple way of doing it, or will i need to change the start/end date to a different format to work out the days they have worked?

any help would be appreciated
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Row 2 - True is month at work
Row 3 - True is Start month
Row 4 - True is End month

Row 5 - Work days in month
Row 6 - Work days in quarter


Book1
ABCDEFGHIJKLMNOP
1StartEndOct-18Nov-18Dec-18Jan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19Aug-19Sep-19
2Employee 102/12/201820/07/2019In workFALSEFALSETRUETRUETRUETRUETRUETRUETRUETRUEFALSEFALSE
3StartFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
4EndFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSE
5work days (month) 3031283130313020
6work days (quarter) 30909120
Sheet4
Cell Formulas
RangeFormula
E2=AND($B2E$1,0),$C2>=E$1)
E3=AND(D2=FALSE,E2)
E4=AND(E2,F2=FALSE)
E5=IF(AND(E2,F2),IF(E3,EOMONTH(E1,0)-$B2+1,DAY(EOMONTH(E1,0))),IF(AND(E4,F4=FALSE),DAY($C2),""))
E6=IF(MOD(MONTH(E1),3)=0,SUM(C5:E5),"")
 
Upvote 0
this is absolutely fantastic and exactly what i was looking for. just one little question with regards to the formula for E5. is there any way that this can be summed so it is in one cell. i like how you have it spread out per month, but im wanting it in one cell (just for the total days worked) so it equals up all the days for the quarter that a person has worked based on their start date
 
Upvote 0
so instead of it working out the days worked month by month, is there a way it will just show the overall days worked. i understand that is what E6 does, but is there a way to get to this without the need of E5, or by only having one formula?
 
Upvote 0
take your picks


Book1
ABCDEFGHIJKLMNOP
1StartEndOct-18Nov-18Dec-18Jan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19Aug-19Sep-19
2Employee 102/12/201820/07/2019In workFALSEFALSETRUETRUETRUETRUETRUETRUETRUETRUEFALSEFALSE
3StartFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
4EndFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSE
5work days (month)2313031283130313020
6work days (quarter)23130909120
Sheet4
Cell Formulas
RangeFormula
D5=SUM(E5:P5)
D6=C2-B2+1
 
Upvote 0
how do i put a table on to explain a little clearer
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
StartEnd
Employee 1In work
Start
End
work days (month)
work days (quarter)

<thead>
[TH="align: center"]A[/TH]
[TH="align: center"]B[/TH]
[TH="align: center"]C[/TH]
[TH="align: center"]D[/TH]
[TH="align: center"]E[/TH]
[TH="align: center"]F[/TH]
[TH="align: center"]G[/TH]
[TH="align: center"]H[/TH]
[TH="align: center"]I[/TH]
[TH="align: center"]J[/TH]
[TH="align: center"]K[/TH]
[TH="align: center"]L[/TH]
[TH="align: center"]M[/TH]
[TH="align: center"]N[/TH]
[TH="align: center"]O[/TH]
[TH="align: center"]P[/TH]

</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]Oct-18[/TD]
[TD="align: right"]Nov-18[/TD]
[TD="align: right"]Dec-18[/TD]
[TD="align: right"]Jan-19[/TD]
[TD="align: right"]Feb-19[/TD]
[TD="align: right"]Mar-19[/TD]
[TD="align: right"]Apr-19[/TD]
[TD="align: right"]May-19[/TD]
[TD="align: right"]Jun-19[/TD]
[TD="align: right"]Jul-19[/TD]
[TD="align: right"]Aug-19[/TD]
[TD="align: right"]Sep-19[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]02/12/2018[/TD]
[TD="align: right"]20/07/2019[/TD]

[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]FALSE[/TD]
[TD="align: right"]FALSE[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]231[/TD]

[TD="align: right"]30[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]20[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]231[/TD]

[TD="align: right"]30[/TD]

[TD="align: right"]90[/TD]

[TD="align: right"]91[/TD]

[TD="align: right"]20[/TD]

</tbody>
</body>
 
Upvote 0
i think i know what you're after, but i'm off now.
i can have a look tomorrow if you still haven't found a solution
 
Upvote 0
so this is what mine looks like roughly. the true/false part works fine on mine and was just what i wanted. with regards to the days worked i want it in one column like this called pro rata. so if they started before the first day of a quarter (01/01/2019) and have not left the company then they have worked the full time. if they have started after the first day of the quarter then work out how many days they have worked up until the end of the quarter (31/03/2019).
if they have left the company then work out how many days they worked between the start of the quarter and their end date. im thinking i am going to need a quarter start date and quarter end date somewhere so i can change these each quarter for future reports. its just the calculation i cant figure out to give me the days they have workedin the quarter. i was hoping to avoid expanding the spreadsheet further because it already has a lot of info on it. hence wanting a formula to just put it in one cell.


StartEnd
Employee 1In work
Start
End
work days (month)



work days (quarter)








<tbody>
[TH="align: center"]A[/TH]
[TH="align: center"]B[/TH]
[TH="align: center"]C[/TH]
[TH="align: center"]D[/TH]
[TH="align: center"]E[/TH]
[TH="align: center"]F[/TH]
[TH="align: center"]G[/TH]
[TH="align: center"]H[/TH]
[TH="align: center"]I[/TH]
[TH="align: center"]J[/TH]
[TH="align: center"]K[/TH]
[TH="align: center"]L[/TH]
[TH="align: center"]M[/TH]
[TH="align: center"]N[/TH]
[TH="align: center"]O[/TH]
[TH="align: center"]P[/TH]

[TD="align: center"]1[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]Jan-19[/TD]
[TD="align: right"]Feb-19[/TD]
[TD="align: right"]Mar-18[/TD]
[TD="align: right"] Pro Rata 9 [/TD]
[TD="align: right"] Feb-19 [/TD]
[TD="align: right"] Mar-19 [/TD]
[TD="align: right"] Apr-19 [/TD]
[TD="align: right"] May-19 [/TD]
[TD="align: right"] Jun-19 [/TD]
[TD="align: right"] Jul-19 [/TD]
[TD="align: right"] Aug-19 [/TD]
[TD="align: right"] Sep-19 [/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]02/12/2018[/TD]
[TD="align: right"][/TD]

[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"] ??????
[/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]Employee 2[/TD]
[TD="align: right"]03/02/2019[/TD]
[TD="align: right"][/TD]

[TD="align: right"] FALSE [/TD]
[TD="align: right"] TRUE
[/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] ?????? [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]

[TD="align: center"] 4 [/TD]
[TD="align: right"]
[/TD]
[TD="align: right"]
[/TD]
[TD="align: right"]
[/TD]

[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] TRUE [/TD]
[TD="align: right"] FALSE [/TD]
[TD="align: right"] FALSE [/TD]

[TD="align: center"] 5 [/TD]
[TD="align: right"]
[/TD]

[TD="align: right"]
[/TD]
[TD="align: right"] 231 [/TD]

[TD="align: right"] 30 [/TD]
[TD="align: right"] 31 [/TD]
[TD="align: right"] 28 [/TD]
[TD="align: right"] 31 [/TD]
[TD="align: right"] 30 [/TD]
[TD="align: right"] 31 [/TD]
[TD="align: right"] 30 [/TD]
[TD="align: right"] 20 [/TD]

[TD="align: center"] 6 [/TD]
[TD="align: right"]
[/TD]

[TD="align: right"]
[/TD]
[TD="align: right"] 231 [/TD]

[TD="align: right"] 30 [/TD]

[TD="align: right"] 90 [/TD]

[TD="align: right"] 91 [/TD]

[TD="align: right"] 20 [/TD]

</tbody>

[/QUOTE]
 
Upvote 0
the work days per quarter are on the right side of the sheet
as its stand an empty column between the 2 sets of data (Col P) is needed


Book1
ABCDEFGHIJKLMNOPQRSTU
1StartEndOct-18Nov-18Dec-18Jan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19Aug-19Sep-19Dec-18Mar-19Jun-19Sep-19Dec-19
2Employee 117/01/201930/06/2019 YesYesYesYesYesYes0749100
3Employee 219/10/201805/09/2019YesYesYesYesYesYesYesYesYesYesYesYes749091670
4Employee 318/12/201830/08/2019YesYesYesYesYesYesYesYesYes149091610
Sheet4
Cell Formulas
RangeFormula
D2=IF(AND($B2D$1,0),$C2>=D$1),"Yes","")
Q2=IF(AND($C2>EDATE(Q$1,-2)),MAX(0,MIN(($C2-$B2),EOMONTH(Q$1,0)-$B2)+1)-SUM($P2:P2),0)
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
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