# Today's date - 5 years

#### Fester675

##### Board Regular
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

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.

#### JLGWhiz

##### Well-known Member
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:

#### Fester675

##### Board Regular
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))))

#### AlphaFrog

##### MrExcel MVP
Try this...

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