30 Advanced Excel Tips for 2026

Excel Champs / Advanced Excel / How to Create a Data Validation with Date Range
By Puneet Gogia (Microsoft MVP)

How to Create a Data Validation with Date Range

Select the cells, go to Data ? Data Validation, set Allow to Date and Data to between, then fill in Start date and End date and click OK. Excel then rejects any date outside that range and anything that is not a date.

Instead of typing fixed dates, point to cells such as =$E$1 and =$E$2, so you can change the range without reopening the dialog. Formulas work too: =TODAY() as the start and =TODAY()+30 as the end allow only the next 30 days.

For a rule the Date option cannot express, choose Custom and enter a formula written for the first selected cell. =AND(A2>=DATE(2026,1,1), A2<=DATE(2026,12,31)) allows dates in 2026, and =WEEKDAY(A2,2)<6 allows weekdays only. Use DATE() rather than typed dates in formulas, so the rule works with any regional date format.

Add a note on the Input Message tab, such as “Enter a date in 2026”, and set the wording users see when they break the rule on the Error Alert tab.

Data validation only checks what is typed in. Pasted values and dates that were already in the cells are not checked, so use Data ? Data Validation ? Circle Invalid Data to find dates outside the range.

Let’s say you need to create a data validation for dates in which you want to use a specific date range. In simple words, when a user enters a date in a cell, you want it to be within a range of dates that you specify.

Well, this can be done by using a custom formula based on the AND function and a simple way of defining dates in the date range option in data validation. Both methods will stop a user from entering a date outside the range.

Steps to Create Date Validation with Date Range

  1. First, select the cell where you want to apply this data validation rule.
  2. Now, go to the Data tab ⇢ Data Validation ⇢ Data Validation.
  3. From here in the data validation dialog box, select “Date” from the “Allow” drop-down.
  4. After that, select “between” from the “Data” drop-down.
  5. Next, you need to enter two dates in the “Start Date” and “End Date” input boxes.
  6. In the end, click OK.

Now, in all the cells you have selected, a user can only enter a date that is within the range of dates you have specified.

Even, instead of entering dates directly into the data validation, you can refer to the cells where you have dates.

This way, you can change the dates at any time without opening the option. You can also use the TODAY function to create a dynamic range of dates.

For example, if the start date is in D1 and the end date is in D2, enter the following in the “Start Date” and “End Date” boxes:

=$D$1
=$D$2

And to allow only dates from today to the next 30 days, use these two in the same boxes:

=TODAY()
=TODAY()+30

Using AND Function to Create a Date Range in Data Validation

The same thing can also be done by using a custom formula based on the AND function.

  1. First of all, select cell A1.
  2. From the data validation dialog box, select “Custom” from the “Allow” drop-down.
  3. Now, in the formula input bar, enter the below formula and click OK.
=AND(A1>=DATE(2016,6,1),A1<=DATE(2016,6,30))

This method is a bit more complex. But if you want to specify the dates one time, then you can use this method.

Make sure the formula refers to the first cell of your selection (A1 here) without dollar signs, so Excel adjusts it for every other selected cell. And just like the first method, you can refer to cells for the dates instead of typing them in the formula:

=AND(A1>=$D$1,A1<=$D$2)

Allow Only Weekdays within a Date Range

The custom formula method is useful when you need one more condition. The following formula allows only Monday to Friday dates between the dates in D1 and D2. WEEKDAY with 2 as the second argument returns 1 for Monday and 7 for Sunday, so a value below 6 means a weekday.

=AND(WEEKDAY(A1,2)<6,A1>=$D$1,A1<=$D$2)

Show a Message for the Date Range

  1. First of all, open the Data Validation dialog box again for the same cells.
  2. After that, go to the “Input Message” tab and enter a message like “Enter a date in June 2016”, which shows when the user selects the cell.
  3. Next, go to the “Error Alert” tab and enter the message you want to show when someone enters a date outside the range.
  4. In the end, click OK.

In the “Error Alert” tab, the “Stop” style blocks the wrong date, while “Warning” and “Information” only show the message and let the user keep it.

Frequently Asked Questions

Why can I still paste a date outside the range?

Data validation only checks values that are typed in. Pasting a value over the cell replaces the validation as well. To find the dates that break the rule, go to Data ⇢ Data Validation ⇢ Circle Invalid Data.

Does the date range include the start and end dates?

Yes. With the “between” option, and with >= and <= in the AND formula, both the start date and the end date are allowed.

Why does a valid date show an error?

The date is probably typed in a format your system doesn’t read as a date, so Excel stores it as text. Enter the date in your system’s date format, like 6/15/2016 for US settings.

7 thoughts on “How to Create a Data Validation with Date Range”

  1. Dear,
    I am looking for a way to formulate that i select a number in one column and month in another column.

    if the month is selected non 31 days it shld display error else it should accept.

    For eg, if 31 November is selected, it shld desplay error.

    thanks.

    Reply
  2. Using date validation in my lot of work books. The issue I am facing in it are
    1. data entry person can fill date outside of range by copying from other cell and pasting on validated cell .I really want a function or formula which can stop pasting any thing on specific cells (not on full sheet).
    2.My sheets are always password protected but data entry person have the password so that he can enter data on the sheets (dates are also to be filled by him) he can change Validation range any time as per his requirement. Can we put any additional protection to avoid any change in validation range.

    Reply
  3. Sometimes when you want dates that may change over time you could place the date range in cells and then reference those cells in the rules. Like you quick tip I use the TODAY() option a lot with my date validations as often the end date is the current day.

    Reply
    • SORRY IT IS NOT DATE IT IS DATA I NEED TO INSERT ADDITIONAL ITEMS ROWS IF I REQUIRE FOR MY ESTIMATE

      Reply
  4. I want to create a vba code for adding my rows with data and formula in same worksheet. code will give popup for which ro you want to insert. suppose my date is from rows a75:q148 i need to insert in row a76:q149

    pls. send me the code on this

    vipul

    Reply

Leave a Comment