30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / How to Random Date Generator in Excel (Formula)
By Puneet Gogia (Microsoft MVP)

How to Random Date Generator in Excel (Formula)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

To generate a random date between two dates, use =RANDBETWEEN($A$2,$B$2) where A2 holds the start date and B2 the end date, then drag it down. The dollar signs lock both references so every row draws from the same range.

If the result shows as a serial number like 46032, that’s expected — dates are stored as numbers, so press Ctrl+1 and set the cell format to Date. In Excel 365, =RANDARRAY(10,1,A2,B2,TRUE) fills ten rows in one go; the final TRUE returns whole numbers, and without it you’ll get dates with a decimal time attached.

Both functions are volatile, so the dates reshuffle on every recalculation — once you’re happy, copy the column and paste it as values (Ctrl+Alt+V → V) to freeze them. For random weekdays only, wrap it in WORKDAY: =WORKDAY(RANDBETWEEN($A$2,$B$2)-1,1).

In this tutorial, we will learn a simple way to generate random dates between two dates (start date and end date). For this, you need to use two different functions that can be used in different situations.

  • RANDBETWEEN
  • RANDARRAY
Generate Random Dates / Excel Formula

Generate Random Dates with RANDBETWEEN

In Excel, we have a function called RANDBETWEEN that takes a start value and an ending value to generate random values between them, and you can use this function to generate random dates.

  1. First, specify a start date from which you want to start your random dates.
  2. Next, specify an end date to have an upper limit for random dates.
  3. After that, enter the function “RANDBETWEEN” in a cell.
  4. Now, refer to the cells where you have the start and end dates in the arguments.
  5. From here, hit enter to get a single random date in the cell.
  6. In the end, drag the formula down to the cell where you want to have the last random date.
randbeetween-for-random-dates
=RANDBETWEEN($A$2,$B$2)

In the above formula, we have used the RANDBETWEEN function with a start date and an end date. As you can see, we have frozen the cell reference to both cells A2 and B2 by using the dollar sign ($). And after that, we have dragged the formula down to cell C11 to get 10 random dates.

RANDBETWEEN returns the date as a serial number (like 45292), so if you see numbers instead of dates, format the cells as dates (Home ➜ Number ➜ Short Date).

Using RANDARRAY for Random Dates

There’s one more function that you can use to generate random numbers, and that’s RANDARRAY (Excel 2021, Excel 2024 and Microsoft 365). This function also takes a starting date (min) and an ending date (max).

When you use RANDARRAY, you need to specify how many dates you want to generate. And you need to specify this in terms of rows and columns. You also need to set the last argument to TRUE, so it returns whole numbers (dates) and not decimals (dates with random times).

randarry-for-random-dates
=RANDARRAY(10,2,A2,B2,TRUE)

In the above formula, I have specified 10 rows and 2 columns, and it has generated 20 random dates (10 x 2) in the result. As it’s a dynamic array formula, you enter it in one cell, and the results spill into the other cells.

Note: Both of the functions we have used above are volatile, meaning that every time the sheet recalculates (when you edit any cell or press F9), all the dates will be re-generated. To keep the dates, copy them and paste them as values (Ctrl + Alt + V, then V and Enter).

Generate Random Weekdays Only

If you want only working days (Monday to Friday), wrap RANDBETWEEN in WORKDAY. It takes the random date, goes one day back, and then moves to the next working day, so a Saturday or Sunday becomes the following Monday:

=WORKDAY(RANDBETWEEN($A$2,$B$2)-1,1)

Because weekend dates move to Monday, Mondays come up more often than other days. And if the end date is a Saturday or Sunday, the result can be the Monday after it.

Generate Random Dates with Time

To get a random date and a random time between the two dates, add a random fraction of the days between them to the start date. Then use a date and time format like dd-mmm-yyyy hh:mm:

=$A$2+RAND()*($B$2-$A$2)

Generate Random Dates without Repeats

RANDBETWEEN and RANDARRAY can return the same date more than once. In Excel 2021 and later, you can make a list of all the dates with SEQUENCE, shuffle it with SORTBY and RANDARRAY, and take the first 10 with INDEX:

=INDEX(SORTBY(SEQUENCE(B2-A2+1,1,A2),RANDARRAY(B2-A2+1)),SEQUENCE(10))

This works as long as the date range has at least 10 days.

Frequently Asked Questions

How do I stop random dates from changing?

Copy the cells and paste them as values. The formulas are replaced with the dates, which then stay as they are.

Can I use dates directly in RANDBETWEEN?

Yes, but use the DATE function so the formula doesn’t depend on your date settings, like =RANDBETWEEN(DATE(2024,1,1),DATE(2024,12,31)).

Why does RANDARRAY return dates with times?

Without TRUE as the last argument, RANDARRAY returns decimal numbers, and the decimal part is a time. Add TRUE to get whole dates.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment