Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default random between function

Hello
I use the random between function to randomly select employees for testing.
I've outlined the problem I'm having below.

Each employee is required to be randomly tested and has a unique number
assigned to them (1-191).

The formula =randbetween(1-191) works well for my purposes when all of the
ones being tested fall between those parameters, but there are many instances
when I want to add specific numbers to the random selection process.....or
not use some of them in that group.

Example 1: select (49,80) and include 136 and/or 141 to that random selection.

Example 2: select (49,80) and not use 59 and/or 72

I'm sure there's a simple way of adjusting the formula as needed, but I
haven't been able to figure it out. Can you help?

Thanks
Arthur
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default random between function

Hello,

...
Example 1: select (49,80) and include 136 and/or 141 to that random selection.


Select (49,82) and treat 81 as 136 and 82 as 141.

...
Example 2: select (49,80) and not use 59 and/or 72


Select (49,78) and treat 59 as 79 and 72 as 80.

You can do this with a helper cell - don't call RandBetween twice :-)

Regards,
Bernd
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default random between function

Thank you for your reply. I understand what youre saying but it doesnt
solve the problem using keystrokes. What if I have the lowest number as 1 and
the highest 191 and there are 25 people eligible for testing€¦€¦that means I
would have to substitute 166 names€¦or allow the random between (1-191) to run
and cross out 166 names. If I have 50 eligibles, then I would want to
randomly select 50 names only and not 191.
Thanks again
Arthur

"Bernd P" wrote:

Hello,

...
Example 1: select (49,80) and include 136 and/or 141 to that random selection.


Select (49,82) and treat 81 as 136 and 82 as 141.

...
Example 2: select (49,80) and not use 59 and/or 72


Select (49,78) and treat 59 as 79 and 72 as 80.

You can do this with a helper cell - don't call RandBetween twice :-)

Regards,
Bernd

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default random between function

"Arthur" wrote:
What if I have the lowest number as 1 and the highest
191 and there are 25 people eligible for testing


Put the 25 numbers in a range of cells, say A1:A25, then use the following
to select randomly:

=index(A1:A25,randbetween(1,25))


----- original message -----

"Arthur" wrote in message
...
Thank you for your reply. I understand what youre saying but it doesnt
solve the problem using keystrokes. What if I have the lowest number as 1
and
the highest 191 and there are 25 people eligible for testing€¦€¦that means I
would have to substitute 166 names€¦or allow the random between (1-191) to
run
and cross out 166 names. If I have 50 eligibles, then I would want to
randomly select 50 names only and not 191.
Thanks again
Arthur

"Bernd P" wrote:

Hello,

...
Example 1: select (49,80) and include 136 and/or 141 to that random
selection.


Select (49,82) and treat 81 as 136 and 82 as 141.

...
Example 2: select (49,80) and not use 59 and/or 72


Select (49,78) and treat 59 as 79 and 72 as 80.

You can do this with a helper cell - don't call RandBetween twice :-)

Regards,
Bernd


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default random between function

Thanks Joe.
I tried it on a few samples and "like magic", the random numbers appeared
with just those employees I wanted to be in the mix. Really appreciate the
help.
Thanks again
Arthur

"JoeU2004" wrote:

"Arthur" wrote:
What if I have the lowest number as 1 and the highest
191 and there are 25 people eligible for testing


Put the 25 numbers in a range of cells, say A1:A25, then use the following
to select randomly:

=index(A1:A25,randbetween(1,25))


----- original message -----

"Arthur" wrote in message
...
Thank you for your reply. I understand what youre saying but it doesnt
solve the problem using keystrokes. What if I have the lowest number as 1
and
the highest 191 and there are 25 people eligible for testing€¦€¦that means I
would have to substitute 166 names€¦or allow the random between (1-191) to
run
and cross out 166 names. If I have 50 eligibles, then I would want to
randomly select 50 names only and not 191.
Thanks again
Arthur

"Bernd P" wrote:

Hello,

...
Example 1: select (49,80) and include 136 and/or 141 to that random
selection.

Select (49,82) and treat 81 as 136 and 82 as 141.

...
Example 2: select (49,80) and not use 59 and/or 72

Select (49,78) and treat 59 as 79 and 72 as 80.

You can do this with a helper cell - don't call RandBetween twice :-)

Regards,
Bernd





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default random between function

Hello,

Aha. You seem to need my UDF VBUniqRandInt:
http://www.sulprobil.com/html/uniqrandint.html

Please note that its the second macro, not the first on that page.

Regards,
Bernd
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default random between function

Thank you for your help and quick response Bernd. I looked at the unique rand
integer you suggested and while I'm certain it works....it's looks to be
beyond my capabilites to install. The last real programming I did was when I
took some computer courses some time ago....and before that I was thrilled
when I was able to watch my name appear on the computer screen 1000's of
times on the vic20.

If I had a tech guy at work, I would have handed it to him and said "here,
install this". But I don't. Fortunately Joe provided a simple program that
seems to work and should be adequate.

Thanks again
Arthur

"Bernd P" wrote:

Hello,

Aha. You seem to need my UDF VBUniqRandInt:
http://www.sulprobil.com/html/uniqrandint.html

Please note that its the second macro, not the first on that page.

Regards,
Bernd

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default random between function

Hello,

No problem. We all just try to help a little bit.

If I do not err, Joe's solution can produce duplicates.

If that's no harm to you...

Regards,
Bernd
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
Random Function PAL Excel Discussion (Misc queries) 2 April 23rd 09 01:08 AM
Random function - weighted Periz28 Excel Worksheet Functions 8 August 5th 06 01:19 AM
random number function junecol Excel Worksheet Functions 1 September 29th 05 02:08 PM
VBA "Rnd" Function: Truly Random? TheRobsterUK Excel Discussion (Misc queries) 2 September 27th 05 04:50 AM
How can I use the random function? petevang Excel Worksheet Functions 1 July 11th 05 03:50 PM


All times are GMT +1. The time now is 02:15 PM.

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"