Extract Year part from Date and convert to text

  • Hi, I am an Excel newbie, just joined this forum :)


    Probably a very simple question for you, but a very hard nut for me since days.


    I formatted field A1 as a date cell

    1/2/1971


    A2 extracts the last two digits from the date
    =MID(YEAR(A1),3,2)

    Result = 71


    Now I wish to convert this number into words in cell A3

    =IF(A2=71,"seventyone","ERROR")


    but I get always "ERROR" instead of "seventyone"


    What I am doing wrong?


    Thanks in advance for your kind help.

  • That's because with MID you extract a string, so when you compare A1=71 it is a string to a number. Should be atleast string to string (or number to number) so your formula in A3 will work with:

    =IF(A2="71","seventyone","ERROR")

    or

    =IF(VALUE(A2)=71,"seventyone","ERROR")