Get instant live expert help with Excel or Google Sheets
“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.

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()

  • 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:
Solution examples
Yes hello Im looking for help on conditional formatting I currently have a conditional format for D9>D32 and so on from D9:S20. I need to add an if statement that references cell D4 if the first four characters are 1358 for the rule to apply can you please assist?
Solved by Z. U. in 20 mins
can you teach me the steps to create a nested if function, and to nest an AND function inside of an IF function?
Solved by A. Q. in 22 mins
Use the Vlookup Function to complete the "employee" column of table 2. Use "job Id" from table 2 as your lookup_value(s) and table 1 as your reference.
Solved by C. H. in 16 mins
I have a list or people who are ranked in numbers from 3 to 6 I need to recognize the contents of each multiple cells and create an equivalent letter. for that value into another column. e.g. Cell E1 = 3 to show in new cell that row (H1) the letter "C" I have multiple rows with different values in column "E" Can this be done?
Solved by I. J. in 30 mins
If a cell in another sheet is populated I need a vlookup done. If the cell is not populated I need the cell to return blank.
Solved by T. D. in 60 mins

Leave a Comment

avatar

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Subscribe to Excelchat.co

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

Another blog reader asked this question today on Excelchat:

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
Trusted by people who work at
Amazon.com, Inc
Facebook, Inc
Accenture PLC
Siemens AG
Macy's
The Allstate Corporation
United Parcel Service
Dell Inc