Quick questions with Google Sheets.
I'm trying to extract the year from a date using the YEAR()
function.
In the first column, I formatted all cells as dates, but in the second column, when I use =YEAR()
and reference the first column I get really unexpected results.
Any ideas?
Best Answer
The reason is that column is also formatted as a date. Format it as a number and you'll get what you're after.
Google Sheets stores dates as a number of days from 12/31/1899. Your
YEAR()
is appropriately pulling out "2010" (for example) but is then converting it to a date. 2010 days after 12/31/1899 is 7/2/1905. (The big clue is that the two sample rows you show are seven years apart in the first column, then 7 days apart in the second column.)