Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Randomize/ Shuffle List in Excel
  • How To Load Analysis ToolPak in Excel
  • How to count table rows in Excel
  • How to add Trendline to a chart in Excel
  • Get column index in Excel Table

References

  • Two-way lookup with VLOOKUP in Excel
  • LOOKUP function: Description, Usage, Syntax, Examples and Explanation
  • How to get last row in numeric data in Excel
  • How to get first row number in range in Excel
  • Count rows with at least n matching values

Data Validations

  • Data validation must not exist in list
  • Excel Data validation only dates between
  • Excel Data validation whole percentage only
  • Excel Data validation with conditional list
  • Excel Data validation don’t exceed total

How to generate random times at specific intervals in Excel

by

To generate random times in at specific intervals you can use the RAND function with the FLOOR function. See example below:

Formula

=FLOOR(RAND(),"0:15")

Explanation

In the example shown, the formula in B6 is:

=FLOOR(RAND(),"0:15")

which generates a random time at a 15-minute interval.

How this formula works

The RAND function generates a decimal number between zero and 1. So, you might get output like this from RAND() in three cells:

0.54739314
0.919767722
0.633760119

Dates in Excel are defined as simple numbers, where 1 = 1 day. This means you can simply divide 1 by the decimal value of time to get a value that corresponds to time as Excel sees it, for example:

1/12 = 12 hours = .5 days
1/6 = 6 hours = .25 days
1/8 = 8 hours = .333 days

This means we can use RAND() to generate a decimal value between 1 and 0, then round that number down with FLOOR to the nearest interval. FLOOR takes a argument called “significance” as the rounding multiple, and it recognizes time intervals expressed like this:

“0:10” – 15 minutes
“0:15” – 10 minutes
“0:30” – 30 minutes
“0:45” – 45 minutes

Setting and upper and lower time

If you want to limit the hours used by RAND, you can use this general formula force RAND to output a number between an upper and lower value:

=RAND()*(upper-lower)+lower

Because Excel can recognize time values, you can get times between 8 AM and 12 PM, with a formula like this:

=RAND()*("12:00"-"8:00")+"8:00"

Note: the formula above is general and will work with other numbers too, not just times.

Post navigation

Previous Post:

How to generate random date between two dates in Excel

Next Post:

Popularly Used Excel Functions and their examples

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • OR function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel TRUE Function
  • Not Equal To ‘<>‘ operator in Excel
  • How to return blank in place of #DIV/0! error in Excel
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Generate series of dates by weekends in Excel
  • How to get workdays between dates in Excel
  • How to calculate months between dates in Excel
  • Add days to date in Excel
  • Get last weekday in month in Excel

Grouping

  • Map inputs to arbitrary values in Excel
  • Map text to numbers in Excel
  • Running count group by n size in Excel
  • Calculate conditional mode with criteria in Excel
  • Group times into 3 hour buckets in Excel

General

  • How to create dynamic worksheet reference in Excel
  • Select, Insert, Rename, Move, Delete Worksheets in Excel
  • Find Most Frequently Occurring Word in Excel Worksheet
  • How to calculate percent of students absent in Excel
  • Excel Default Templates
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning