VideoPhoto

Showing posts with label randbetween. Show all posts
Showing posts with label randbetween. Show all posts

20 September, 2023

Generating Random Times, Dates, Datetimes

We can quite easily generate all kinds of random numbers using Excel functions like RAND or RANDBETWEEN. The same functions allow us generate also random time and date, but the formulas involved are a bit more complicated. Here are some examples of values calculated with formulas provided beneath the table.

The following formulas have been used for times and dates shown in the five columns (from left to right):

=TEXT(RAND(),"HH:MM:SS")

=TEXT(FLOOR(RAND(),"00:00:05"),"HH:MM:SS")

=TEXT(RAND()*(15-14)/24+14/24,"HH:MM:SS")

=TEXT(RANDBETWEEN("2024-07-01","2024-12-31"),"YYYY-MM-DD")

=TEXT(RAND()*("2024-12-31 12:00:00"-"2024--07-01 12:00:00")+"2024-07-01 12:00:00","YYYY-MM-DD HH:MM:SS")




24 January, 2022