Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dojistar
 
Posts: n/a
Default How to generate #'s that excludes certain numbers?

Hi, I'd like to generate 4 different numbers from 1 to 50 but EXCLUDING
numbers 3 and 24. Your help is greatly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
vezerid
 
Posts: n/a
Default How to generate #'s that excludes certain numbers?

There are several ways. One way is to use two columns: In column K:K
(say starting from K2) you enter all the admissible numbers. Then, one
column before, type 0 in J2 and then in J3 type =J2+1/48 and copy all
the way to J49.

Then, to generate random numbers use:
=VLOOKUP(RAND(), $J$2:$K$49,2)
This will produce your numbers with equal probability.

Another, not so precise formula:
=IF(RAND()<2/48, 1+INT(RAND()*2), IF(RAND()<20/48, 4+INT(RAND()*20),
25+INT(RAND()*26)))

HTH
Kostis Vezerides

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default How to generate #'s that excludes certain numbers?

"dojistar" wrote
.. I'd like to generate 4 different numbers from 1 to 50
but EXCLUDING numbers 3 and 24.


Another play to try ..

List the numbers 1 - 50 into A1:A48, skipping 3 and 24

Put in B1: =RAND()
Copy B1 down to B48

Put in C1: =INDEX(A:A,RANK(B1,$B$1:$B$48))
Copy C1 down to C4

C1:C4 will return what's required

Just press F9 to regenerate
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--


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
How to generate a list of randomly selected numbers within a range Bob Excel Worksheet Functions 2 November 7th 05 06:09 PM
GENERATE RANDOM NUMBERS BUT EXCLUDE A NUMBER IN THE SEQUENCE Tracker Excel Discussion (Misc queries) 6 August 5th 05 02:49 AM
How do I generate random lottery numbers in Excel? Mark1809 Excel Worksheet Functions 7 July 31st 05 07:23 PM
generate consecutive numbers Mark New Users to Excel 6 March 15th 05 06:45 PM
generate random numbers Jules Excel Worksheet Functions 6 November 2nd 04 05:57 PM


All times are GMT +1. The time now is 11:11 AM.

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

About Us

"It's about Microsoft Excel"