Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default What function will give me a random full number from 1 to 6


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default What function will give me a random full number from 1 to 6

=1+INT(RAND()*6)

HTH. Best wishes Harald

"Audrey" skrev i melding
...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default What function will give me a random full number from 1 to 6

VBA
num = int(rnd()*6+1)

Excel
=trunc(rand()*6+1)

--
Regards,
Tom Ogilvy

"Audrey" wrote in message
...



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default What function will give me a random full number from 1 to 6

On Sun, 8 May 2005 06:06:04 -0700, Audrey
wrote:

and just for another method, if you have the Analysis ToolPak installed:

=RANDBETWEEN(1,6)

If this function is not available, and returns the #NAME? error, install and
load the Analysis ToolPak add-in.

On the Tools menu, click Add-Ins.
In the Add-Ins available list, select the Analysis ToolPak box, and then click
OK.
If necessary, follow the instructions in the setup program.

--ron
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default What function will give me a random full number from 1 to 6

In the formulas below, it struck me as odd you used INT in the VBA one but
avoided it in the Excel one. Is there a programming reason for this, or is
it just a personal preference?

Thanks
Darren



On Sun, 8 May 2005 09:50:35 -0400, Tom Ogilvy wrote:

VBA
num = int(rnd()*6+1)

Excel
=trunc(rand()*6+1)



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default What function will give me a random full number from 1 to 6

Trunc is more descriptive, but not available in VBA. The INT
worksheetfunction has no relation to the VBA INT function.

--
Regards,
Tom Ogilvy

"Darren Hill" wrote in message
news:opsqgwcamved89cl@omega...
In the formulas below, it struck me as odd you used INT in the VBA one but
avoided it in the Excel one. Is there a programming reason for this, or is
it just a personal preference?

Thanks
Darren



On Sun, 8 May 2005 09:50:35 -0400, Tom Ogilvy wrote:

VBA
num = int(rnd()*6+1)

Excel
=trunc(rand()*6+1)



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default What function will give me a random full number from 1 to 6

Thanks for clarifying.

Darren

On Sun, 8 May 2005 21:31:09 -0400, Tom Ogilvy wrote:

Trunc is more descriptive, but not available in VBA. The INT
worksheetfunction has no relation to the VBA INT function.




--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
function to give the number of hours force530 Excel Worksheet Functions 3 September 22nd 06 12:03 AM
generate a random number and use if function to generate new data Dogdoc1142 Excel Worksheet Functions 4 April 26th 06 03:44 AM
random number function junecol Excel Worksheet Functions 1 September 29th 05 02:08 PM
How do I find random number in list of random alpha? (Position is. jlahealth-partners Excel Discussion (Misc queries) 0 February 8th 05 05:31 PM
Minutes multiplied by a number to give a number Mally Excel Discussion (Misc queries) 4 January 19th 05 05:21 PM


All times are GMT +1. The time now is 09:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"