Home > Back-end >  How to extract year from an excel cell containing an old date?
How to extract year from an excel cell containing an old date?

Time:01-03

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

CodePudding user response:

2/12/1875 is before the beginning of the 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)))

CodePudding user response:

Try this-

=TAKE(TEXTSPLIT(A1,"/"),,-1)

enter image description here

  • Related