Converting Years to Days

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
This sounds simple. There are 365 days in a year so YearValue*365, right? Unfortunately no. There is not 365 days in every year, this in itself makes me sad. But I digress.

So I am trying to figure out what a persons "mandatory retirement date" would be based off of certain criteria. The certain criteria part is easy, what I am having trouble with is excel calculating the right date.

For example; If I entered in 2009/08/17 and have reached a position where my mandatory retirement date is 20 years later, on the last day of the month, then my retirement date should be 2029/08/31.

There are other instances where 20 is not always the answer either, there are instances where it could be 8, 13, 20, 22, 27, and 30. HOWEVER, if the separation date is less than 20 years, i.e. 8 or 13, then the retirement date is on the same day they are to be released.

For example; 2009/08/17 and did not reach a certain position, now my mandatory separation date is 13 years, which would be 2022/08/17.

Can anyone help me figure this out?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
ABC
1Entered dateSeparation yearsRetirement date
217-Aug-09<strike></strike><strike></strike>20Enter given formula here and drag down
317-Aug-09<strike></strike><strike></strike>13

<tbody>
</tbody>

Code:
=IF(B2>=20,DATE(YEAR(A2)+B2,MONTH(A2),DAY(EOMONTH(A2,0))),DATE(YEAR(A2)+B2,MONTH(A2),DAY(A2)))
 
Upvote 0
As a matter of law, I believe your premise is incorrect.

The annual anniversary date of an event is the same month and day of a future year.

The only exception is Feb 29. AFAIK, Feb 28 is the correct annual anniversary date of Feb 29, if there is no Feb 29 that year.

So if D1 contains the original date and N1 contains the number of years:

=EDATE(D1, 12*N1)

is the annual anniversary date.
 
Upvote 0
@razaas
Your formula may have some problems with leap years - try it with the examples in rows 4 & 5 of my sample data below.
@Robby19
See if this formula, copied down, does what you want. Is that what you expect the results to be? If not what results do you want and why?

Excel Workbook
ABC
1DateYearsRetirement
217/08/20092031/08/2029
317/08/20091317/08/2022
429/02/20082228/02/2030
515/02/19942229/02/2016
605/12/2010905/12/2019
Final Date
 
Upvote 0
@Robby19
See if this formula, copied down, does what you want. Is that what you expect the results to be? If not what results do you want and why.

Thank you for the formula. This seems to work as well as the other one. What about adding in additional criteria, for example;

If Rank Value = 3 and DCC = AW then it should be separation date + a number to bring them to April of the following year. The day does not matter, it just needs to get them to April.

If Rank Value = 3 and DCC = AT then it should show their current separation date.

If Rank Value = 5 and DCC = AW or AT and current total service is less than 20 years, it should show their 20 year mark. If over 20 years, it should be their current separation date.

If Rank value = 6 and DCC = AW or AT and current total service is less than 22 years, it should show their 22 year mark. If over 22 years, it should be their current separation date.

I know this is a lot, but I am truly stumped.
 
Last edited:
Upvote 0
So far I have the Rank Val = 3 formula written
Code:
=IF(AND([@[Rank Val]]=3,[@DCC]="AW",[@[April Calc]]<0),[@EAS],IF(AND([@[Rank Val]]=3,[@DCC]="AW",[@[April Calc]]>0),[@ECC]+[@[April Calc]],IF(AND([@[Rank Val]]=3,[@DCC]="AT"),[@EAS],IF(AND([@[Rank Val]]=3,[@DCC]="AT"),[@EAS],IF([@[Service Limit]]<20,EDATE([@AFADBD],[@[Service Limit]]*12),EOMONTH([@AFADBD],[@[Service Limit]]*12))))))

This seems to work fine. Any ideas how I can get the others. If I am not mistaken, I believe the nested IF limit is 7 IF statements, correct? The way I am doing this, it will end up being more than 7.
 
Upvote 0
I'm sure there is a more efficient way to write this, but my brain is jello. So whatever.

Code:
=IF(AND([@[Rank Val]]=3,[@DCC]="AW",[@[April Calc]]<0),[@EAS],IF(AND([@[Rank Val]]=3,[@DCC]="AW",[@[April Calc]]>0),[@ECC]+[@[April Calc]],IF(AND([@[Rank Val]]=3,[@DCC]="AT"),[@EAS],IF(AND([@[Rank Val]]=5,[@DCC]="AW",[@EAS]>[@[20 Yr Mark]]),[@EAS],IF(AND([@[Rank Val]]=5,[@DCC]="AT"),[@EAS],IF(AND([@[Rank Val]]=6,[@DCC]="AW",[@EAS]>[@[20 Yr Mark]]),[@EAS],IF(AND([@[Rank Val]]=6,[@DCC]="AT"),[@EAS],IF([@[Service Limit]]<=20,EDATE([@AFADBD],[@[Service Limit]]*12),EOMONTH([@AFADBD],[@[Service Limit]]*12)))))))))
 
Upvote 0
I have no idea what "Rank Value" or "DCC" is or where they are located or what they have to do with the problem.
 
Upvote 0

Forum statistics

Threads
1,214,530
Messages
6,120,071
Members
448,943
Latest member
sharmarick

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