Home » How to Generate Random Dates in Google Sheets

How to Generate Random Dates in Google Sheets

by Erma Khan

You can use the following basic syntax to generate a random date between two dates in Google Sheets:

=TO_DATE(RANDBETWEEN(DATE(2015,1,1),DATE(2022,12,31))) 

This particular formula will generate a random date between 1/1/2015 and 12/13/2022.

The following example shows how to use this formula in practice.

Example: Generate Random Dates in Google Sheets

We can type the following formula in cell A2 to generate a random date between 1/1/2015 and 12/31/2022:

=TO_DATE(RANDBETWEEN(DATE(2015,1,1),DATE(2022,12,31))) 

The following screenshot shows how to use this formula in practice:

We can see that the formula produced the date 4/30/2018.

If we click and drag this formula down to other cells in column A, the formula will automatically produce a list of random dates between 1/1/2015 and 12/31/2022:

The result is a list of 20 date that all fall between 1/1/2015 and 12/31/2022.

Note #1: Whenever you update the value of any other cell in the worksheet and press Enter, the value of the random dates will change.

Note #2: If you don’t use the TO_DATE() function in the beginning of the formula, the random date that is generated will be formatted as a numeric value instead of a date.

Additional Resources

The following tutorials explain how to perform other common tasks in Google Sheets:

How to Add & Subtract Years from Date in Google Sheets
How to Sort by Date in Google Sheets
How to AutoFill Dates in Google Sheets

Related Posts