#### random number generator

```hi there i don't know if this is the right section, however I was
wondering is there some vba or formulae to generate random numbers in a
certain range

I would be very greatful if you can help me

Thanks

Owen

--
------------------------------------------------------------------------

```
 0
12/30/2005 11:20:02 PM
excel 39879 articles. 2 followers.

5 Replies
496 Views

Similar Articles

[PageSpeed] 15

```I like J.E. McGimpsey's =RandInt().

http://www.mcgimpsey.com/excel/udfs/randint.html

>
> hi there i don't know if this is the right section, however I was
> wondering is there some vba or formulae to generate random numbers in a
> certain range
>
> I would be very greatful if you can help me
>
> Thanks
>
> Owen
>
> --
> ------------------------------------------------------------------------

--

Dave Peterson
```
 0
petersod (12004)
12/30/2005 11:30:05 PM
```=rand() and pull down is the plain answer.  May not meet your need's.

HTH
Regards,
Howard

>
> hi there i don't know if this is the right section, however I was
> wondering is there some vba or formulae to generate random numbers in a
> certain range
>
> I would be very greatful if you can help me
>
> Thanks
>
> Owen
>
>
> --
> ------------------------------------------------------------------------
> http://www.excelforum.com/member.php?action=getinfo&userid=30016
>

```
 0
lhkittle (223)
12/30/2005 11:30:16 PM
```Try this.  Assign a keyboard combo to it, hit the combo and you will be
prompted for an upper bound, a lower bound and then as to whether you want
decimals or integers.

Sub RandomNumber()
ubnd = InputBox("Enter Upper Bound")
lbnd = InputBox("Enter Lower Bound")
nudp = InputBox("Just hit OK for Integers or type D for decimals")

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

On Error GoTo Oops:
c = Selection.Cells.Count
x = 1

If UCase(nudp) = "D" Then
With Selection
.ClearContents
.NumberFormat = "#,##0.00"
End With
For Each cell In Selection
cell.Value = Rnd() * (ubnd - lbnd) + lbnd
Application.StatusBar = Round(x / c, 2) * 100 & "% Done"
x = x + 1
Next cell
Else
With Selection
.ClearContents
.NumberFormat = "#,##0"
End With
For Each cell In Selection
cell.Value = Int(Rnd() * (ubnd - lbnd + 1) + lbnd)
Application.StatusBar = Round(x / c, 2) * 100 & "% Done"
x = x + 1
Next cell
End If

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.StatusBar = False
Oops:     Exit Sub

End Sub

--
Regards
Ken.......................    Microsoft MVP - Excel
Sys Spec - Win XP Pro /  XL 97/00/02/03

------------------------------�------------------------------�----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------�------------------------------�----------------

>
> hi there i don't know if this is the right section, however I was
> wondering is there some vba or formulae to generate random numbers in a
> certain range
>
> I would be very greatful if you can help me
>
> Thanks
>
> Owen
>
>
> --
> ------------------------------------------------------------------------
> http://www.excelforum.com/member.php?action=getinfo&userid=30016
>

```
 0
ken.wright (2489)
12/31/2005 12:25:30 AM
```Say, RandBetween(1, 100) ; more details from the Help File. Regards.

```
 0
tkt_tang (117)
12/31/2005 3:07:09 AM
```"manclad" wrote:
> I was wondering is there some vba or formulae
> to generate random numbers in a certain range

..... With what distribution?  So far, every respondent has
ass-u-me-d you want a uniform distribution.  I wonder if
you might be interested in another distribution, e.g. a
normal distribution.
```
 0
12/31/2005 11:00:02 AM

Similar Artilces:

Generating Multiple Choice Tests
I currently use Access 2003 to create tests. I am looking to use a grouping and random sampling method to improve efficiency. In as much that I use access to create tests now, is VBA an appropriate platform for randomizing and group sampling or should I go to an independent language. Any advice will be greatly appreciated. -- mhm karst, ******UNTESTED... Something like... SELECT TOP 1 Rnd([TestID]) AS Expr1, TestText FROM tblTests ORDER BY Rnd([TestID]) -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, inform...

numbering #4
Is there any system of 'outline numbering' in Excel? Hope i'm not asking for too much! -- Dr. Sachin Wagh MBBS, DHA, DPH Nothing as easy as the outlining within MSWord. Typing the numbers is one way (not very appealing). Using a formula based on the values in the other cells may work--if you can pickout something that would indicate the level--not very nice, either. Dr. Sachin Wagh wrote: > > Is there any system of 'outline numbering' in Excel? Hope i'm not asking for > too much! > -- > Dr. Sachin Wagh > MBBS, DHA, DPH -- Dave Peterson ...

random number generator
hi there i don't know if this is the right section, however I was wondering is there some vba or formulae to generate random numbers in a certain range I would be very greatful if you can help me Thanks Owen -- manclad ------------------------------------------------------------------------ manclad's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30016 View this thread: http://www.excelforum.com/showthread.php?threadid=497074 I like J.E. McGimpsey's =RandInt(). http://www.mcgimpsey.com/excel/udfs/randint.html manclad wrote: > > hi there ...

Number Format Problem
I am importing data from a program at work. The data come in in th format of ###@##(three numbers, a letter, and then 2 more numbers). The problem is that when a code such as 123E04 is imported, exce thinks it means 1.23E+04. This is a problem becasue the data I need i the E04 part. (I use the RIGHT(cell,3) formula to get the portion want.) Any ideas on how to get the number in the format I want? have tried changing the cell characteristics, and all kinds of stuff. Thank -- kola556 ----------------------------------------------------------------------- kola5567's Profile: http://...

Need trailing zeroes to show for range of numbers....
The file I pulled into Excel for some reason cut off 2 trailing zeroes, no matter how I format it they will not show up. There are thousands of them and I can't see typing in each one over just to get two zeroes on the end. Does anyone know of a way to format this so they will show up? I have searched Microsoft online with no help. Not too much information, but try this (after saving your workbook!) In an empty cell enter the numner 100. Edit>Copy Select your data Edit>Paste Special, check Multiply -- Kind Regards, Niek Otten Microsoft MVP - Excel "Sueshe" &...

I have a formula that reads a list of dates in cells K5 through K20 an compares these dates to 1 date in cell M3. Cell M3 shows a date bu when I run the evaluate formula auditing tool on the formula, M3 date shows as a number, thus the formula fails. Any hel -- pete576 ----------------------------------------------------------------------- pete5761's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2961 View this thread: http://www.excelforum.com/showthread.php?threadid=49423 Dates are stored as number of days since 1-1-1900. So today (dec 16,2005) is stored as...

Generate URL and trigger
Let's see if I even phrase this question correctly. We use an Access DB to enter appointments for our company. There are hundreds of querys, but in reality all the information is stored in one Table. (There are other tables used for drop down info, etc.) We are going to start using a web based software that will do additional things for us. We will continue to use the Access DB. The Web software guys are telling me to have our Access DB generate a URL for each appointment entered and have it automiatically uploaded to their software using the auto generated URL. They acted...

count the number of new lows within a range of cells
Hello, Is there a formula or method to count the number of new lows within a range of cells? For example, the following are in col A rows 5 to 14. Within this set a new low has been reached 3 times- (96,95,94). What I would like is a formula or macro that that would produce the results - 3. There are about 9000 rows of data and I am looking for "count of new lows within the preceding 10 rows" on a rolling basis. Thanks. 100 101 96 97 98 97 95 97 94 95 Version 1: Use this if the 9000 or so rows don't have blanks in them. In this version you just need to select the first cel...

maximum number of indexes per SQL table that Access (jet) can deal with?
why is there a maximum number of indexes per SQL table that Access (jet) can deal with? is it really the count of indexes + statistics? I've seen plenty of documentation that states that typically DSS systems have twice as much index space as data space.. So I don't think that it's a case of 'over-indexing' I'm just tired of a crippled Jet front end and other people making me 'temporarily drop my indexes' so that they can link to my tables using Jet. has this bug gone away with Access 2007? Is it going away with Access 2010? ...

Restart numbering ater a set number of rows
I have an excel spreadsheet with 4 columns. the first two columns contains numbers which will never change the third column starts off with 0 (zero) and is repeated for 255 rows then on the 256 row it needs to change to 1 (so basically increment by 1 every 255 rows) the fourth column starts at 0 (zero) and counts up to 255 but then needs to reset it self back to 0 on the 256 row. Help Please!!!!!:confused: ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ One way: I...

Exchange server rebooting randomly
Hello, My exchange 2000 sp3 server is experiencing ramdom reboots. In the event log I get an error 5000 from lsasrv. I did not experiece this error before in the test enviroment. I reinstalled the server the same way when we installed it in our production enviroment. The only difference is that I installed Exchange rollup update post SP3. Has anyone have anidea what might be the problem. Thanks Bernard "Bernard M." <BernardM@discussions.microsoft.com> wrote: >My exchange 2000 sp3 server is experiencing ramdom reboots. In the event log >I get an error 5000 from ...

excel putting random cells into date format
I opened a new spreadsheetand started inputting data. About 100 lines into a very simple sheet of only 3 columns the numbers started turning inot dates all by them selves. I highlighted the cells and reformatted to the general formatting and it immediately went back to the date format. Additionally, when I printede the spreadsheet it printed pages and pages of blank gridlined sheets until I realized it and turned off the printer. THen when I saved the file it was 7meg! This file had 5 pages, 3 colums each and no more than 300 rows each. I cut and pasted the data into a spreadsh...

Generate current month
=SUMPRODUCT((TEXT(A6:A500,"mmm")="jul")*1) is what I was given to get referrals in a current month. I'm setting up a general program so that it is easy to use for my co-workers and supervisors. Is there a way to insert something for "jul" that will enter the current month on its own? Hi try =SUMPRODUCT((TEXT(A6:A500,"mmm")=TEXT(TODAY(),"mmm"))*1) Though I would use: =SUMPRODUCT(--(MONTH(A6:A500)=MONTH(TODAY()),--(A6:A500<>"")) -- Regards Frank Kabel Frankfurt, Germany Brandy wrote: > =SUMPRODUCT((TEXT(A6:...

Adding an apostrophe to a column of numbers
Hello, I need to add an apostrophe to each cell in a long column of numbers. I do not want to format them as text or format them as custom - our system requires the apostrophe at the beginning of the cell. My question is - is there a way to format one cell with the apostrophe and then copy that apostrophe down to the other cells?? or can someone write me something that will allow me to do it quickly? I want to avoid having to go into each cell and put the apostrophe in! Thank you in advance.... One way. Change 9 to your column Sub addapostophe() mc = 9 'column I For i = ...

How do I insert a specific number in a gantt bar
Hi I,m attempting to insert a specific number into a gantt bar or edit default text in the format box. Any body help? Hi GarryB, I'm not sure I understand completely what you are trying to do. I'm guessing edit the information which shows next to the bars on the Gantt chart? Insert a custom field into the table through Insert > Column and pick on of the text columns. Enter the value you want to show. Then Format > Bar Styles. Select the bar type and on the Text tab, select the custom field. I hope this helps. Let us know how you get along. Julie Pr...

How to generate different series of document nos for different users..
We would like GP 8.0 to auto-generate different document numbers for each user. For example: User A will be assigned INV document numbers 1-100 and User B will assigned INV document numbers 101-200 and so on. Is that possible in GP 8.0? If so, how do I go about it? Any ideas? Thanks very much in advance for you help. -Surendra It would have to be a customized solution. VBA or Dexterity are your best bets, for now. With GP 9 you will be able to use Visual Studio 2005 to create customizations, too. "Surendra" wrote: > We would like GP 8.0 to auto-generate different do...

generate .NET code from visio 2003
Hi ! How can i Generate .NET code from a UML made in visio 2003 ? I did searh the net and found this link but it says 404 ? http://msdnaa.net/Resources/Display.aspx?ResID=1949 the article title is Generating .NET Code Using Visio Enterprise Architect's UML So any one know how do that or any one have back up copy of this article Thanks which version of v2003 are you using. The EA version which comes with vs.net I believe has the process in the help facility. v2003 pro does not support forward engineering of uml... Al "Suhail Kaleem" <suhailkaleem@mailyoulike.com>...

Mutliple Page Number sets
I'm setting up a book to go out to short run press. Using publisher because I get it through license for super cheap, so it didn't make sense to purchase an expensive publishing suite. But I want to do some things with the page numbers that I can't figure out to do. I want and intro and foreword to be in roman numerals, and then the main body of the text to have regular page numbers. What I really can't figure out though, is how to get the page numbers to start on "1" with the first page (currently starting on 11. I have Master Sheets applies to the differ...

CRM should allow auto numbering of the products
---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=9c8e0ba6-f37a-4fc1-84fd-ff5b578e2c76&dg=microsoft.public.crm ...

PO next number changes randomly GP10
Hello, The company I currently work for has been seeing the next PO number being changed in the purchase order processing screen. This occurs randomly. To try to determine the cause of this, I have turned on the activity tracking as well as sql triggers on the pop40100 table. Has anyone else seen this before or have any suggestions on how to determine what is causing this to change? Any help would be greatly appreciated. Thank you, JC Hi JC when you say it is changing what do mean? I believe that the PO numbers will go back and fill in for PO's that have been deleted. I.E. i...

create a cell that accumulates, numbers from another cell...
I need to know how to have a entery cell that can send number values to a cell that accumilates there sum .the entries in the entery cell can be changed and the recieving cell just keeps adding up. The entry cell can be left blank and the sum remains in recieving cell. -- Thanks sombull http://www.mcgimpsey.com/excel/accumulator.html -- Regards, Peo Sjoblom "sombull" <sombull@discussions.microsoft.com> wrote in message news:41021B44-363C-418C-9A4F-6CD126431698@microsoft.com... > I need to know how to have a entery cell that can send number values to a > cell ...

From VBA: How to select a column by column number instead of letter? #2
I'm in MS Access and don't know from column letters - all my constants are in terms of column number. I'd like to select, say, column number 7 and hide it.... ? -- PeteCresswell Gord and I sent you a macro solution for EXCEL as this is an Excel ng. -- Don Guillett SalesAid Software donaldb@281.com "(Pete Cresswell)" <x@y.z> wrote in message news:uch701tveuot081n0q0h9rpq1r0c24v1sc@4ax.com... > I'm in MS Access and don't know from column letters - all my constants are in > terms of column number. > > I'd like to select, say, column number...

OWA 2003 number of emails viewable
Hello, I was wondering if anyone knew where to set the number of viewable emails in OWA? By default it does not allow very many to be displayed. Thanks, Greg It's 25 by default. In OWA, click the Options button and then check the 'Messaging Options' section. There's an option called 'Number of items to display per page'. -- Neil Hobson Exchange MVP For Exchange news, links and tips, check: http://www.msexchangeblog.com "Greg" <anonymous@discussions.microsoft.com> wrote in message news:107801c47b40\$76dd3b30\$a401280a@phx.gbl... > Hello, > I...

Lowest number excluding zero
I have five columns for each vendor and I am trying to determine who has the lowest price out of the seven vendors. The data is not in an array. The critical data would be in i.e. cells: T20, Z20, AF20, AL20, AQ20 and AV20. I want to calculate the lowest price excluding zero out of those cells. I experimented by putting numbers into B4, C5, D6 and E7 I used Insert | Name | Define (in XL 2003) to define MYDATA to refer to =Sheet1!\$B\$4,Sheet1!\$C\$5,Sheet1!\$D\$6,Sheet1!\$E\$7 In XL 2007 use Formulas | Define names | Define Name Then In a cell I typed =MIN(mydata) and it returned the low...

Form of phone numbers in contact list
I am using Blackberry's Desktop Software to syncronize with my MS Outlook Contacts list. The onboard caller-id function of the phone that is supposed to correlate the incoming phone number to a name of a contact (should the number be in my contacts list) isn't working. According to help from Blackberry the problem is the "form" of the numbers as they're being loaded on the Blackberry from MS Outlook. Specifically, apparently the fact that the numbers are stored in the form of (###) ###-#### instead of something like ###-###-#### is keeping the phone from realizi...