Date problem

J

JohnUk

I am trying extract just the year from a date, ie
the cell would contain - 29/04/2004
Now if I go =Right(B2,4) in the hope I get - 2004, I end
up with the date code. How can I get around this? I have
tried all sorts, from pivots to pasting specials.
Many thanks in advance
John
Ps even if it needs some VBA, (but at a last resort)
 
F

Frank Kabel

Hi
try
=YEAR(A1)
an format the cell as 'Number' or if you want a text
string use
=TEXT(A1,"YYYY")
 
Top