Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to extract year from a excel cell containing an old date?

When I have a date like 2/12/2022 in a cell in an excel document (say in the cell A1),

=year(A1)

gives 2022, but this does not work for a date like 2/12/1875.
Indeed it returns #Value!.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

2/12/1875 is before the beginning of the date system in Excel.
To see the beginning, as per your system, write 1 and format as a date:

enter image description here

In general, using the =YEAR() formula is not possible before the beginning of the first serial number, thus you should resort to other options. Like this one:

=RIGHT(A2,4)

or a more complicated one, that gives the last element in A2, separated by "/":

=RIGHT(A2,LEN(A2)-SEARCH("/",A2,SEARCH("/",A2,SEARCH("/",A2)+1)))

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading