Ask a question »

Excel - IF function using Dates and Text

May 2015


[Excel] IF function using Dates and Text




Issue


I'm trying to write a function for a cell which refers to a date in another cell - which if it is between 01/01/1994 and 31/12/1995 the cell will read U16, but if the date is between 01/01/1996 and 31/12/1997 it will read U14 and if the date is later than 01/01/1998, it will read U12.

Solution


Considering that your date entry is in A1:



=IF(AND(A1>="1/1/94"+0,A1<="12/31/95"+0),"U16",IF(AND(A1>="1/1/96"+0,A1<="12/31/97"+0),"U14",IF(A1>=1/1/98,"U12","")))



Remember in Excel the dates are entered as mm/dd/yy

Note


Thanks to venkat1926 for this tip on the forum.
For unlimited offline reading, you can download this article for free in PDF format:
Excel-if-function-using-dates-and-text.pdf

See also

In the same category

Published by aakai1056.
This document entitled « Excel - IF function using Dates and Text » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.