10

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.

Says we're all the way back to 1905

Any ideas?

1 Answer 1

12

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.)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.