Excel – How to set up data validation to allow only a date or a specific string

data validationmicrosoft excel

I would like to use data validation to ensure someone has entered a valid date, but I'd also like them to be able enter TBD – just those two options. Is this at all possible without VBA? Is there a custom formula I could enter into the data validation tool?

Best Answer

You can do this by setting the cell format to Text and then setting up a custom data validation rule.

To set the cell format, right-click the data entry cell and choose Format Cells.... Then set the category to Text.

To set up custom data validation, select the data entry cell, click Data Validation on the Data ribbon. Set the Allow box to Custom. Then enter the formula below, where A1 is the address of your data entry cell.

=OR(A1="TBD",NOT(ISERROR(DATEVALUE(A1))))

This will allow entry of "TBD" or anything that Excel automatically recognizes as a date. This may allow some irregular formats you did not have in mind, such as mm/dd-yyyy or m-d. You'll need to take a different approach if you want only certain date formats to be allowed.

Related Question