Random numbers add pointless decimals at end of whole number

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
774
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Good day,

I have a formula
Excel Formula:
=RAND()*(1999999999-1000000001)+ 1000000001
which gives me a random 10 digit number beginning with 1. However if I copy the number and paste over to another cell end up getting the number but with a decimal.

For example a number such as 1489498658 I end up getting 1489498658.42415. I tried changing formats to numbers with 0 Decimals.

Any assistance would be greatly appreciated.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Because it is generating a number with a decimal digit in the first place. Change the formatting of the cell with the formula to number and bump up the decimals. You can enclose the whole formula in an int function if you want integer.
1709917370777.png
 
Upvote 0
Because it is generating a number with a decimal digit in the first place. Change the formatting of the cell with the formula to number and bump up the decimals. You can enclose the whole formula in an int function if you want integer.
View attachment 108096
I did try changing the format to a number with 0 decimals and I'm still getting a number followed by a dot and four numbers.
 
Upvote 0
Or use

Excel Formula:
=RANDBETWEEN(1000000000,9999999999)

If you want to stick with RND() you need to use

Excel Formula:
=INT(RND()*(1999999999-1000000001)+1000000001)

like Livin404 said, because RND() creates numbers with more than 10 decimals places.
 
Upvote 0
Solution
Or use

Excel Formula:
=RANDBETWEEN(1000000000,9999999999)

If you want to stick with RND() you need to use

Excel Formula:
=INT(RND()*(1999999999-1000000001)+1000000001)

like Livin404 said, because RND() creates numbers with more than 10 decimals places.
Thank you I used the INT version. The only thing I changed was I used Rand rather than Rnd.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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