View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default extract year from the date in a cell


Excel stores dates as numbers, today is 38792, tomorrow is 38793 etc. so
if you have today's date in B9 and use =left(B9,4) it will give you
"8792".

to get the year in another cell either use

=TEXT(B9,"yyyy")

for a text result or

=YEAR(B9)

for a numeric result or

=B9

and format as "yyyy"

for the spaces try

=TEXT(YEAR(B9),"0 0 0 0")")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=523216