Generate Large Random number (125 digits) without scientific E+ at end

robbertly

New Member
Joined
Oct 19, 2014
Messages
32
Hi All,

Quick question.

I want to generate a list of random numbers each 125 digits long, including zeros, with a full output - not reduced to an E+ number.

Excel seems to have limit on the RAND and RANDBETWEEN after about 17 digits.

Any suggestions appreciated.

Thanks,
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Build a string using VBA, insert some character at the beginning so Excels knows it's a string, then loop 125 times.

Why on earth would you need a random number 125 digits long?
 
Upvote 0
You could use the long-winded formula shown in F1 below, or a user-defined function with code along the lines suggested by Special-K99.
To implement the UDF..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in G1 below and copy down if required.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)
Code:
Function Lrand(n As Long) As String
  Dim i As Long
  Randomize
  
  For i = 1 To n
    Lrand = Lrand & Int(Rnd() * 9)
  Next i
End Function

<div class="cms_table">
</div>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,095
Messages
6,123,072
Members
449,093
Latest member
ripvw

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