Want my zeros

pctechtv

New Member
Joined
Mar 11, 2010
Messages
41
Hi, I have a special need to let Excel generate random numbers in a string of text like this.
="PCTECHTV"&(INT(RAND()*100000))&"INT3"
The result PCTECHTV34729INT3 with the random being 34729 or what ever it generates.
Now this if working for me except I need 5 numbers always and it is some time generating 4. I guess this is because some times INT(RAND()*100000) comes up with number s with zeros with it and that is fine but I want the zeros to show. I don't want to us INT(RAND()*100000) in a separate cell and format that to display 5 numbers and then have to add it to the =. Does any one know of a way to do this in the formula? Or?
Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Pctechtv

Or try this:

="PCTECHTV"&INT(RAND()*(99999-10000)+10000)&"INT3"

Or

="PCTECHTV"&INT(RAND()*89999+10000)&"INT3"

Markmzz
 
Upvote 0
="PCTECHTV"&LEFT(RAND()*9^9,5)&"INT3"

to change the length of random number change the underlined number

hope this helps..
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,790
Members
452,942
Latest member
VijayNewtoExcel

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