Today's date - 5 years

Fester675

Board Regular
Joined
Sep 16, 2016
Messages
141
Hi all - I NEED SOME HELP!!

I have 3 drop down lists - DATE (D2); MONTH (E2); YEAR (G2)

I have annual leave allowance based on time served - (Q2) 25.0 (<5 years service); (Q3) 30.0 (>5 years service but started after 30/4/2013); (Q4) 31.5 (>5 years service and started on or prior to 30/4/2013)

My problem is when 2019 is selected in (G2) it results in 30.0 (Q3) - this is the only year with a problem!!

Here's the formula used...

=IF(G2="YEAR","",IF(AND(YEAR(TODAY())-G2<5,YEAR(TODAY())>G2),Q2,IF(DATE(G2,E2,D2)<=DATE(2013,4,30),Q4,IF(DATE(G2,E2,D2)>DATE(2013,4,30),Q3))))
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
If it would not cause your results to be a day off, try using 'less than/equal to ' and 'greater than/equal to'
Code:
<=
>=
that would keep the results from being zero for some of the formula parts, which seems to be part of the problem. You are only using the equal to in one place at present. It seemed to work right when I changed it on a test setup.
 
Last edited:
Upvote 0
Thanks JLG - but it's still not changing!
I'm guessing that I'm going to have to use all 3 dropdown boxes to determine the precise date? So - is the YEAR <5 years, the month & year <5 years, the dd/mm/yyyy <5 years from the current day; and the same for >=

=IF(G2="YEAR","",IF(AND(YEAR(TODAY())-G2<=5,YEAR(TODAY())>=G2),Q2,IF(DATE(G2,E2,D2)<=DATE(2013,4,30),Q4,IF(DATE(G2,E2,D2)>=DATE(2013,4,30),Q3))))
 
Upvote 0

Forum statistics

Threads
1,224,743
Messages
6,180,686
Members
452,994
Latest member
Janick

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