3
Thanks

A few words of thanks would be greatly appreciated.

Apply an IF Function Using Dates and 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.



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

Image: © Dzmitry Kliapitski - Shutterstock.com
3
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on by Olivia Long.

This document, titled "Apply an IF Function Using Dates and Text," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).
1 vote - 4.0 /5

1 Comment

-
This helped me out - thank you so much