MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 15th, 2002, 10:25 PM   #1
clintonjh
New Member
 
Join Date: May 2002
Location: Australia
Posts: 25
Default

Does anyone know how to generate up to 6 random numbers from a series?

Would appreciate some help.

Thank you
clintonjh is offline   Reply With Quote
Old May 15th, 2002, 10:57 PM   #2
eliW
Board Regular
 
eliW's Avatar
 
Join Date: Mar 2002
Posts: 1,805
Default

Quote:
On 2002-05-15 21:25, clintonjh wrote:
Does anyone know how to generate up to 6 random numbers from a series?

Would appreciate some help.

Thank you
Hi clintonjh,

If your numbers are range A1:A30 for example, then put in an empty cell (B1) the formula:

=INDEX($A$1:$A$30,RANDBETWEEN(1,30))

Drag it down 6 rows and you'll get 6 random numbers from your series.
You can also use F9 to get another new 6 numbers.

Eli
eliW is offline   Reply With Quote
Old May 16th, 2002, 01:05 AM   #3
sen_edp
Board Regular
 
sen_edp's Avatar
 
Join Date: Mar 2002
Location: Hellas
Posts: 553
Default

Hello

Dave Hawley wrote a UDF called Randlotto

take a look

http://www.mrexcel.com/board/viewtop...rum=2&start=20

Hope that helps
__________________
Best Regards
Andreas
sen_edp is offline   Reply With Quote
Old May 16th, 2002, 07:38 AM   #4
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default

Sub Jack() ' Lucky_Lottery_Numbers
'I designed this as i felt like it really & just to learn a bit.
'The trick was not to random produce numbers, but to FIND numbers selected at rand
'All in all the type of code can be used for many diff ideas, the search system
'is cool and will do the business, the loop will give a list and custom as desired

'As with all my work, i could not care if you use the codes or hack, bastardise it, but
'i do dedicate all my work to friends.

'(Please.. If you use my codes...
'Give a kind thought to them, they all me the world to me)

' Dedicated to ......... (ive delete this bit people how know me well will know –
‘ I dedicate to my lost friends – I miss so much normally
‘ yes I do name them …. Take care friends!

On Error GoTo Z


Application.ScreenUpdating = False
Dim Lottery_Numbers(6)
Range("B4:O6,E7:K7").Select
With Selection
.Borders(xlLeft).LineStyle = xlNone
.Borders(xlRight).LineStyle = xlNone
.Borders(xlTop).LineStyle = xlNone
.Borders(xlBottom).LineStyle = xlNone
.BorderAround LineStyle:=xlNone
.Interior.ColorIndex = xlNone
End With
Range("A1").Select
For Different_Number = 1 To 6
Choose:
Lottery_Numbers(Different_Numbers) = Int((49) * Rnd + 1)
Cells.Find(What:=Lottery_Numbers(Different_Numbers)).Activate
Selection.BorderAround Weight:=xlThin, ColorIndex:=xlAutomatic
If Selection.Interior.ColorIndex = 35 Then GoTo Choose
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Next Different_Number
Z:

End Sub


MARKER Lotto
__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK is offline   Reply With Quote
Old May 16th, 2002, 07:42 AM   #5
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default


You will need to have cells with number exactley in these cells or edit the range in the code see post above.



Microsoft Excel - Lottery No.xls_______________Running: xl2002 XP : OS = Windows (32-bit) NT 5.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
M10=
*BCDEFGHIJKLMNO
41234567891011121314
51516171819202122232425262728
62930313233343536373839404142
7***43444546474849****
Jack In the UK's Lottery Number

To see the formula in the cells just click on the cells hyperlink

The above image was automatically generated by [HtmlMaker V1.20]
If you want this code, click here and Colo will email the file to you.
This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo


_________________
If you can help a guy in trouble -
If you can sort that nagging problem -
Pease try, at home, at work or on a message board.

Others help you!
So PLEASE help if you can - If only the once.

Thank you -

Rdgs
======

[ This Message was edited by: Jack in the UK on 2002-05-16 06:44 ]
Jack in the UK is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:59 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes