Random select time from game clock

catiexcel

New Member
Joined
Apr 13, 2023
Messages
13
Office Version
  1. 365
Platform
  1. Windows
For quality analysis I want to select a random 20 minutes from a 80-minute rugby game. How do I customise the '=TEXT(RAND(), "MM:SS")' so that its giving me a starting number between 0.00 and 80.00?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi & welcome to MrExcel.
How about
Excel Formula:
=RANDARRAY(1,1,TIME(0,0,0),TIME(1,20,0))
and format the cell as [mm]:ss
 
Upvote 0
One of these gives the random second, the other gives the random whole minute:
MrExcelPlayground16.xlsx
A
969:43
1027:00
Sheet14
Cell Formulas
RangeFormula
A9A9=TEXT(RAND()*80/1440,"[mm]:ss")
A10A10=TEXT(INT(RAND()*80)/1440,"[mm]:ss")
 
Upvote 0
James,

If they want to select a complete random 20 minute block from an 80 minute game, wouldn't you want the start time to be capped at 60 minutes?
If you start the random block at any point after 60 minutes, you cannot get a full, complete 20 minute block.
 
Upvote 0
I had the idea that they wanted 20 random one minute blocks. That seems silly now.
 
Upvote 0
James,

If they want to select a complete random 20 minute block from an 80 minute game, wouldn't you want the start time to be capped at 60 minutes?
If you start the random block at any point after 60 minutes, you cannot get a full, complete 20 minute block.
I actually realised this when I tried a few solutions, it does make sense to cap it to 60 so I've adapted that.
 
Upvote 0
Hi & welcome to MrExcel.
How about
Excel Formula:
=RANDARRAY(1,1,TIME(0,0,0),TIME(1,20,0))
and format the cell as [mm]:ss
Thank you! This works great for what I need. I'm wondering now is there possibly a way to generate two 10-minute blocks in the same 80-mins but don't overlap?
 
Upvote 0
How about
Excel Formula:
=RANDARRAY(1,1,TIME(0,0,0),TIME(0,30,0))
and
Excel Formula:
=RANDARRAY(1,1,TIME(0,40,0),TIME(1,10,0))
 
Upvote 0
This is ridiculous, but there is not constraint on when the two 10-minute periods start happen, except not to overlap. They could be the first two ten minutes.
Excel Formula:
=LET(a,RANDARRAY(1,1,TIME(0,0,0),TIME(1,10,0)),b,RANDARRAY(10,1,TIME(0,0,0),TIME(1,10,0)),c,ABS(b-a),d,FILTER(b,c>10/1440),e,INDEX(d,1),f,IF(SEQUENCE(2)=1,a,e),f)
 
Upvote 0
Solution
This is ridiculous, but there is not constraint on when the two 10-minute periods start happen, except not to overlap. They could be the first two ten minutes.
Excel Formula:
=LET(a,RANDARRAY(1,1,TIME(0,0,0),TIME(1,10,0)),b,RANDARRAY(10,1,TIME(0,0,0),TIME(1,10,0)),c,ABS(b-a),d,FILTER(b,c>10/1440),e,INDEX(d,1),f,IF(SEQUENCE(2)=1,a,e),f)
That'll do it!
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,461
Members
452,645
Latest member
Tante

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top