Calculate Date + 2 years starting 1st Jan

monkeyharris

Active Member
Joined
Jan 20, 2008
Messages
370
Office Version
  1. 365
Platform
  1. Windows
Having a mental block. I'm setting up a staff holiday calendar and need to calculate when staff are awarded extra holiday based on service.
So, an employee gets an extra day after 2 years, problem is, if they joined in July 2022, they won't get the additional holiday until the January of 2025, so the formula needs to calculate 05/07/22 to today, and if more than 2 years, automatically say 1, after 4 years it's 2, 6 years is 3, 8 years is 4 and 10 years is 5 days extra.

A1 shows their joining date. Example 05/07/22 so their addition day will appear in 2025 calendar.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
you could use datediff
=int(DATEDIF(A1,TODAY(),"Y")/2)
to calculate the entailments as of now
but how does 1 jan fit in ???
maybe with a min

min(int(DATEDIF(A1,TODAY(),"Y")/2),5)

Book1
ABC
15-Jul-045
26-Jul-065
36-Jul-085
47-Jul-105
57-Jul-125
68-Jul-145
78-Jul-164
89-Jul-183
99-Jul-202
1010-Jul-221
1110-Jul-240
Sheet1
Cell Formulas
RangeFormula
C1:C11C1=MIN(INT(DATEDIF(A1,TODAY(),"Y")/2),5)
 
Upvote 0
you could use datediff
=int(DATEDIF(A1,TODAY(),"Y")/2)
to calculate the entailments as of now
but how does 1 jan fit in ???
maybe with a min

min(int(DATEDIF(A1,TODAY(),"Y")/2),5)

Book1
ABC
15-Jul-045
26-Jul-065
36-Jul-085
47-Jul-105
57-Jul-125
68-Jul-145
78-Jul-164
89-Jul-183
99-Jul-202
1010-Jul-221
1110-Jul-240
Sheet1
Cell Formulas
RangeFormula
C1:C11C1=MIN(INT(DATEDIF(A1,TODAY(),"Y")/2),5)
Thanks Etaf.
The 1st Jan comes into it because the holiday year runs from 1st Jan to 31st Dec. If you join midway through the year, the additional date earnt doesn't count until the next holiday year.
 
Upvote 0
so the calc can be carried anytime in excel - just wont apply till the 1st jan, in which case rather than today - should be 31/12/24
not sure how you want to include that info

not quite sure of the process you will use it for
i assume at omepoint you just feed into a 2025 holiday entiltemt

so maybe the endate should be 31/dec/24

=MIN(INT(DATEDIF(A1,DATEVALUE("31/12/2024"),"Y")/2),5)

Book1
ABC
15-Jul-045
26-Jul-065
36-Jul-085
47-Jul-105
57-Jul-125
68-Jul-145
78-Jul-164
89-Jul-183
99-Jul-202
1010-Jul-221
1131-Dec-221
121/1/230
Sheet1
Cell Formulas
RangeFormula
C1:C12C1=MIN(INT(DATEDIF(A1,DATEVALUE("31/12/2024"),"Y")/2),5)
 
Upvote 0
Try.
A2=Entry date, Calculation for today's date.
In B2
Excel Formula:
=INT(DATEDIF(DATE(YEAR(A2)+(((DAY(A2)>1)+(MONTH(A2)>1))>0),1,1),TODAY(),"Y")/2)
 
Upvote 0
Hi, here's another option you could try.

Book1
AB
1Start DateExtra Days
25-Jul-20045
36-Jul-20065
46-Jul-20085
57-Jul-20105
67-Jul-20125
78-Jul-20144
88-Jul-20163
99-Jul-20182
109-Jul-20201
1110-Jul-20220
1210-Jul-20240
131-Jan-20221
142-Jan-20220
151-Jan-20202
162-Jan-20201
Sheet1
Cell Formulas
RangeFormula
B2:B16B2=MATCH(YEAR(TODAY())-YEAR(A2-1)-1,{-1,2,4,6,8,10},1)-1
 
Upvote 0

Forum statistics

Threads
1,223,578
Messages
6,173,168
Members
452,504
Latest member
frankkeith2233

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