How to generate fixed length of random numbers ?

navinrb

Board Regular
Joined
Jun 9, 2020
Messages
82
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
  3. Web
Please help to generate random numbers between 0 -9 with fixed length of 10 digits .
I applied randbetween (0^10,9^10) but its generating some nine or eight digits also....
Thanks in advance .
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Then you need to use 0 as the lower limit for the formula and apply a custom format to the cell so show 10 digits.

So that you can spam people with unsolicited marketing calls? ?
Lol nooooo.???... i m refering just length as mobile numbers as its always 10.?
 
Upvote 0
try
0825088883
3396680293
6403055112
1309056566
3582188093
7589873653
6593737129
1538303915
4221790517
=BASE(RANDBETWEEN(0+1,10000000000-1),10,10)
I know, I know 0+1 = 1 :biggrin: but looks fine ;)
 
Upvote 0
try
0825088883
3396680293
6403055112
1309056566
3582188093
7589873653
6593737129
1538303915
4221790517
=BASE(RANDBETWEEN(0+1,10000000000-1),10,10)
I know, I know 0+1 = 1 :biggrin: but looks fine ;)
Yeah its what i am looking for as i got some numbers with starting zero also but.also numbers are on text format...if i convert to numbers its lenght are changing..so i think i need to custom format that to . Thank you. !
 
Upvote 0
=--BASE(RANDBETWEEN(0+1,10000000000-1),10,10)
=--TEXT(RANDBETWEEN(1,9999999999),"0000000000")
in both cases you'll need custom format: 0000000000
Cell Formulas
RangeFormula
N2:N12N2=--TEXT(RANDBETWEEN(1,9999999999),"0000000000")
O2:O12,Q2:Q12O2=ISTEXT(N2)
P2:P12P2=--BASE(RANDBETWEEN(0+1,10000000000-1),10,10)
 
Upvote 0
My original formula returned Text values. Sandy's post has formulas returning real numbers which you must then custom format in order to retain leading zeros. We do not know whether you need to use these numbers in some kind of mathematical formula or if they are ID's or have some other purpose that do not require them to be used in further numerical calculations. If the latter, my original formula will work fine for you, but if you need real numbers that have to be custom formatted, then instead of converting my original formula the way Sandy did, I would simply use this formula instead and then custom format it...

=RANDBETWEEN(1,9999999999)
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,947
Members
449,480
Latest member
yesitisasport

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