Excel - Apply IF Function Using Dates and Text

August 2016

This article will teach you how to apply an IF function on an Excel spreadsheet by using dates and text.

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

See also :

This document entitled « Excel - Apply IF Function Using Dates and Text » from CCM (ccm.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.