ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Create 5 of 6 digits randomly. (https://www.excelbanter.com/new-users-excel/212118-create-5-6-digits-randomly.html)

Shaun

Create 5 of 6 digits randomly.
 
I would like to create a random conformation number, but only make the last 5
of 6 digits random. I would like to make the first number be the hour witch
the meeting time will start. For ex. (743856) 7 for 7:00 and the other 5
would be random. Any help would be greatly appreciated.

macropod[_2_]

Create 5 of 6 digits randomly.
 
Hi Shaun,

Perhaps:
=A1&TEXT(INT(RAND()*10^5),"00000")
where A1 contains the fixed value. If you need the result as a number, you could use:
=VALUE(A1&TEXT(INT(RAND()*10^5),"00000"))

--
Cheers
macropod
[MVP - Microsoft Word]


"Shaun" wrote in message ...
I would like to create a random conformation number, but only make the last 5
of 6 digits random. I would like to make the first number be the hour witch
the meeting time will start. For ex. (743856) 7 for 7:00 and the other 5
would be random. Any help would be greatly appreciated.


Dave Curtis

Create 5 of 6 digits randomly.
 
Hi Shaun,

Simplifying macropods answer slightly, you can use

=--(A1&INT(RAND()*10^5))

to give you the result you need. The double negative coerces the result of
the concatenation into a number.

Dave

url:http://www.ureader.com/msg/10356918.aspx

macropod[_2_]

Create 5 of 6 digits randomly.
 
Hi Dave,

Unfortunately, that approach drops the leading 0s from the value returned by the RAND function. You could use:
=--(A1&TEXT(INT(RAND()*10^5),"00000"))

--
Cheers
macropod
[MVP - Microsoft Word]


"Dave Curtis" wrote in message .. .
Hi Shaun,

Simplifying macropods answer slightly, you can use

=--(A1&INT(RAND()*10^5))

to give you the result you need. The double negative coerces the result of
the concatenation into a number.

Dave

url:http://www.ureader.com/msg/10356918.aspx



All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com