Go Back

How to Use Data Validation for a Date in the Next 30 days

Data Validation is a feature in Microsoft Excel which restricts the values or type of data that users enter into a cell.  It automatically checks whether the value entered is allowed based on the specified criteria. This step by step tutorial will assist all levels of Excel users in allowing only dates in the next 30 days.  

Figure 1. Final result: Data validation date in next 30 days

Working formula: =AND(C3>TODAY(),C3<=(TODAY()+30))

Syntax of AND Function

AND function evaluates all logical tests and returns TRUE if all arguments are TRUE; FALSE if one or more arguments is FALSE

=AND(logical1, [logical2], ...)

  • logical1–  the first condition that we want to test
  • only logical1 is required; succeeding logical conditions are optional  

Syntax of TODAY Function

TODAY function returns the current date


  • TODAY function does not have any arguments
  • It can be used in combination with other functions and mathematical operations to obtain the desired results

Setting up Our Data

Our table consists of two columns: Order No. (column B) and Delivery Date (column C).  We want to restrict the delivery dates entered in column C and allow only dates falling in the next 30 days.  We can do this by applying Data Validation.

Figure 2. Sample data: Data validation date in next 30 days

Supposing the date today is January 29, 2019, then the date 30 days from today would be February 28, 2019.  Hence, we want to allow only the dates in between January 29, 2019 and February 28, 2019.

Allow only dates in next 30 days

We want to restrict the dates that we input in column C to dates falling in the next 30 days using Data Validation.  We can do this by creating a validation rule using the AND and TODAY functions. Let us follow these steps:

Step 1.  Select the cells whose values we want to restrict.  In this case, select cells C3:C7

Step 2.  Click the Data tab, then the Data Validation menu and select Data Validation

Figure 3.  Selecting Data Validation

The Data Validation dialog box will pop up.  

Figure 4.  Data Validation preview

Step 3.  Click the Allow: drop-down button and select Custom as Validation criteria

Step 4.   Enter the following in the Formula bar:  =AND(C3>TODAY(),C3<=(TODAY()+30))

Figure 5.  Creating a data validation rule

Our AND formula contains two criteria.  First, it evaluates if the date in C3 is greater than the date today.  Next, it evaluates if the date in C3 is less than or equal to the date 30 days from today, as given by the formula TODAY()+30.  

Excel stores dates as serial numbers, making it possible to perform calculations involving dates. In this example, we refer to the date today as January 29, 2019, while the date 30 days from now would be February 28, 2019.  

 For every date entered in column C that falls in between January 29, 2019 and February 28, 2019, the validation criteria returns TRUE, Data Validation passes and the value is allowed. Otherwise, Data Validation fails and the value is restricted.  

Step 5.   Click OK

We have now restricted the values in C3:C7 to allow only the dates falling in the next 30 days from today.  Let us try and enter “2/21/2019” into cell C3.  

Figure 6.  Date falling in the next 30 days allowed by Data Validation

The date “2/21/2019” is allowed because it is only 23 days from the date today, satisfying the Data Validation rule.  

Now let’s input “12/25/2018” into cell C4.

Figure 7.  Past date in year 2018 restricted by Data Validation

The date “12/25/2018” is a past date, hence Data Validation has restricted the input of “12/25/2018” into cell C4.  For restricted values, Excel shows a default warning message that says:

“The value you entered is not valid.  A user has restricted values that can be entered into this cell.”  

We are then presented with three options: Retry, Cancel or seek Help.  

Let’s use another example and enter the date “6/30/2019” into cell C4.  

Figure 8.  Date beyond 30 days from today restricted by Data Validation

Once again, data validation fails because the date “6/30/2019” does not fall in the next 30 days from today.

 Data Validation is very accurate in allowing only the values as specified in the formula or validation criteria.  See below table that is filled up with dates in column C falling within the next 30 days from today, and allowed by Data Validation.  

Figure 9.  Output: Data Validation date in next 30 days

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Column A "Date Received" Column C "Priority" is validation list with options P1-P6 Column D "Due Date" .. How do I make Column D calculate the due date, based on which option is selected in Column C in conjunction with the date in Column A? PI = Date Received P2 = Date Received P3 = Date Received + 1 day P4 = Date Received + 5 business days P5 = Date Received + 14 business days P6 = Date Received + 30 business days
Solved by D. U. in 14 mins
Needing help expressing a date based on date range If Date = 01 OCT 2017 - 30 APR 2018 + 380 DAYS If Date = 01 MAY 2018 - 31 JUL 2018 + 270 DAYS If Date = 01 AUG 2018 - 30 SEP 2018 + 430 DAYS
Solved by E. J. in 19 mins
I need a simple formula for conditional formatting which will light up a cell if the date in the cell approaches within 30 days from todays date. Example if a cell had 9/30/2018 in it, and today's date is 9/11/2018, the cell would light because todays date is less than 30 days away.
Solved by K. L. in 16 mins

Leave a Comment