# using a year in a date

A

#### andy

I have a list of employees and have calculated their retirement dates. this
among other things are calculated on sheet 1 (labeled senioritylist). On
sheet 2 I want to calculate the percentage of employees that have reached
their retirement date or are within 5 years of retirement, and then do the
same in the 5-10 year retirment group, etc. I was trying to use
=countif(senioritylist!k3:k58,"(today()+365.25*5)") but that does not work.
What am I doing wrong?

G

#### Gary''s Student

Actually you were very close:

=COUNTIF(senioritylist!K3:K58,"<=" & (TODAY()+365.25*5))

is a "reasonable" estimate.

S

#### Sheeloo

If you want to check the dates falling before today + five years use
=COUNTIF(senioritylist!K3:K58,"<" & (TODAY()+365.25*5))

also > will give you dates falling AFTER 5 year

I prefer to use
=DATE(YEAR(TODAY())+5,MONTH(TODAY()),DAY(TODAY()))

A

#### andy

thank you so very much "Gary"s Student" I mulled that over all day at work.

N

#### Niek Otten

In L3, put:

=DATEDIF(K3,TODAY(),"y")
and copy down

In K60, put:
=COUNTIF(L3:L58,">=5")

A

#### andy

Ok, I took my stupid pills today. Using your formula, I tried to change the
5 year to 10 years and subtract out the 5 year retirees. It doesn't work. I
tried
=COUNTIF(SENIORITYLIST!K3:K58,"<="&(TODAY()+365.25*10))-COUNTIF(senioritylist!K3:K58,"<=" & (TODAY()+365.25*5)) What do you think?

G

#### Gary''s Student

Is the answer at least close??

A

#### andy

yeah, your original formula worked to figure out how many were within 5 years
of retirement, but when I try the expanded formula to try and find out how
many within 10 years of retirement and then subtract out the 5 years. I get
an error to the formula.