display yrs of Svc

L

Ltat42a

Hi...hope you can help.

I have a few worksheets with some personnel info. I put all of this in
one worksheet. One of the items I have listed is their promotion date.

On another worksheet, I copy the promotion date so I can do a
calculation (=Personnel!E6). The formula I use to calculate their time
in grade is
=IF(E8<>"",DATEDIF(E8,TODAY(),"y"),"")

The problem I have, if the promotion date in the "Personnel" sheet is
blank, the formula is returning a value of 106 instead of being blank
until I enter a promotion date on the "Personnel" worksheet.

Cell E6 on the "personnel" sheet is the promotion date
Cell E8 on "sheet2" is copied from the personnel sheet
Cell E9 on "sheet2" contains the above formula, and it's returning a
value of 106.

Is there a way to fix that?
Thanx
 
P

pinmaster

That is because excel see's a blank cell as 0 Jan 1900 so.

Instead of:

=Personnel!E6
use
=IF(Personnel!E6<>"",Personnel!E6,"")

HTH
J
 
R

Roger Govier

Hi

One way would be to just test that E8>0
=IF(E8>0,DATEDIF(E8,TODAY(),"y"),"")
If E6 is blank, then copying E6 would return 0 which Excel would
interpret as being day 0 (01 Jan 1900) hence the Datedif calculation
returns 106 years.
 
Top