Random number Generator gives decimals after the minimal number of digits.

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
774
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I have a formula I use
Excel Formula:
=RAND()*(1999999999-1000000001)+ 1000000001
which gives me a random 10 digit number always beginning with 1. I've set the format to 0 decimals and numbers. Unfortunately I get decimals for example 1946194471.75967. I only want to be left with the first 10 digits. I thought it may have been a leading apostrophe which isn't the case. Any suggestions. The number of decimals after the number can vary. I hope someone may have a bit of advice.
Thank you,
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
not sure why it shows declimals for you, it does not show them in my excel, anyway you can try this:

=LEFT(RAND()*(1999999999-1000000001)+1000000001;10)
 
Upvote 0
not sure why it shows declimals for you, it does not show them in my excel, anyway you can try this:

=LEFT(RAND()*(1999999999-1000000001)+1000000001;10)
I tried your code and I think it is missing a "(" somewhere in there.
 
Upvote 0
maybe your excel use "," instead ";"

Otherwise try to find left function in your excel and play with it. You define word and how many characters it should take (begining from the start of text)
 
Upvote 0
Solution
maybe your excel use "," instead ";"

Otherwise try to find left function in your excel and play with it. You define word and how many characters it should take (begining from the start of text)
Thank you, that worked!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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