How to apply if function in Excel: with dates, with text

How to apply if function in Excel: with dates, with text

The IF function is one of the most flexible functions in Microsoft Excel and has a range of uses that can be helpful in comparing data entries and isolating specific data points. The IF function can be used to evaluate both dates and text in Microsoft Excel and this article will teach you how to do so.

To use IF functions with dates and text:

Let's take the example of a school administrator who is trying to group together classes for the upcoming year. The administrator needs to split students into three different classrooms, based on their dates of birth. If a student is born between 01/01/1994 and 31/12/1995, he or she will be assigned to room U16; if he or she is born between 01/01/1996 and 31/12/1997, he or she will be assigned to U14; and if the student's birth date is later than 01/01/1998, he or she will be assigned to U12 .

Assuming that your date entry is in A1, the following formula would apply. (Note that all dates are entered in mm/dd/yy format):

=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","")))

All text entries in this example would be placed into column B2. Depending on the actual input cell of your data, you can easily change each instance where A1 is found.

Any more Excel questions? Check out our forum!
Around the same subject

Excel