Data Validation: Restrict to enter dates between two dates only

Main Lesson: Data validation in Excel

To restrict a user to enter dates between two dates only, use the Data Validation feature. In this example, we will illustrate, how to restrict to enter dates between two dates only. For this, execute the following steps:

1- Select a range of cells where you want to apply the data validation rule. In our example, that is A2:A7.

2- In the Data tab, go to the Data Tools section and select the Data Validation.

3- The Data Validation box will appear. Select Custom from the Allow option then enter the following formula:

=AND(A2>=D1,A2<=D2)

4- Press OK. Result. Excel will not let you enter other than specified logic.

Explanation: The above used formula has the AND function, which has following two arguments:

logical1 – A2>=D1 means value to be enter in the cell A2 must be equal to or greater than value in D1.

[logical2] – A2<=D2 means value to be enter in the cell A2 must be equal to or smaller than the value in D1.