I want to do data validation using excel on a column of the type:
year followed by "-" followed by another year.
example 2010-2011 Can this be done using excel formulas? Can we use regex for this?
Try this formula (assumes A1 contains value to validate):
=AND(LEN(A1)=9, MID(A1,5,1)="-", ISNUMBER(LEFT(A1,4)+0),ISNUMBER(RIGHT(A1,4)+0))
This will correctly identify the following examples:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.