Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
STEVEB
 
Posts: n/a
Default Random Number Generator


Hi,

Does anyone have any suggestions for a Random Number Generator that
would only return weekdays?

This is my current formula (which works great but generates Saturday &
Sunday days):


=RAND()*($F$4-$F$3)+$F$3

F3= 38,353
F4= 38,564

Any help would be greatly appreciated!

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=389443

  #2   Report Post  
bj
 
Posts: n/a
Default

try
= 38352+randbetween(1,5)+7*rand between(0,30)

"STEVEB" wrote:


Hi,

Does anyone have any suggestions for a Random Number Generator that
would only return weekdays?

This is my current formula (which works great but generates Saturday &
Sunday days):


=RAND()*($F$4-$F$3)+$F$3

F3= 38,353
F4= 38,564

Any help would be greatly appreciated!

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=389443


  #3   Report Post  
STEVEB
 
Posts: n/a
Default


dj,

Thanks for your help.

I am still getting Saturday & Sunday. Have I written the formula
correctly?

=38352+RANDBETWEEN(1,5)+7*RANDBETWEEN(0,30)

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=389443

  #4   Report Post  
Max
 
Posts: n/a
Default

"STEVEB" wrote
.. suggestions for a Random Number Generator that
would only return weekdays?


Here's one play which will return only random weekdays from within a defined
period (Start date to End date) ..

In Sheet1
------
Put the start date in A1: 01-Jan-2005
Copy A1 down to A212, to fill the range till the end date in A212:
31-Jul-2005

Put

in B1:
=IF(OR(WEEKDAY(A1,2)={6,7}),"",ROW())

in C1:
=INDEX(A:A,MATCH(SMALL(B:B,ROWS($A$1:A1)),B:B,0))

in D1:
=IF(ISERROR(C1),"",RAND())

Select B1:D1, fill down to D212

Col B is an arb. col which assigns row numbers for weekdays within A1:A212.
Col C extracts the weekdays from col A as marked in col B to the top
Col D will generate the underlying randomization for use

---
Then, in any new sheet, say, in Sheet2
-----
a. To generate random weekdays down a column

Put in any starting cell, say A2:
=INDEX(Sheet1!C:C,MATCH(SMALL(Sheet1!D:D,ROWS($A$1 :A1)),Sheet1!D:D,0))

Format A2 as date and copy A2 down
(can copy down a max of 150* rows)

b. To generate random weekdays across a row

Put in any starting cell, say, C1
=INDEX(Sheet1!$C:$C,MATCH(SMALL(Sheet1!$D:$D,COLUM NS($A$1:A1)),Sheet1!$D:$D,
0))

Format C1 as date and copy C1 across
(can copy across a max of 150* cols)

Each press of the F9 key will regenerate the random weekdays

*If you look at the outputs in Sheet1, there's only 150 weekdays within the
defined period.
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


  #5   Report Post  
Max
 
Posts: n/a
Default

Format A2 as date and copy A2 down
(can copy down a max of 150* rows)


Format C1 as date and copy C1 across
(can copy across a max of 150* cols)


Just a clarification that the random weekdays generated within the (max) 150
cells filled down/across will be non-repeating random weekdays from within
the 150 weekdays in the source range (col C in Sheet1)
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----




  #6   Report Post  
bj
 
Posts: n/a
Default

I screwed up use
=38354+RANDBETWEEN(1,5)+7*RANDBETWEEN(0,30)
I meant to start with a sunday and I started with a friday.

the
"STEVEB" wrote:


dj,

Thanks for your help.

I am still getting Saturday & Sunday. Have I written the formula
correctly?

=38352+RANDBETWEEN(1,5)+7*RANDBETWEEN(0,30)

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=389443


  #7   Report Post  
STEVEB
 
Posts: n/a
Default


Thanks Max,

Everything worked Great! I really appreciate your Help!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=389443

  #8   Report Post  
Max
 
Posts: n/a
Default

You're welcome !
Appreciate the feedback
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"STEVEB" wrote in
message ...

Thanks Max,

Everything worked Great! I really appreciate your Help!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile:

http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=389443



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 number without repeating? nonoi via OfficeKB.com Excel Worksheet Functions 2 July 11th 05 05:59 AM
Random Number Generator Pascale Excel Worksheet Functions 3 July 9th 05 12:37 AM
generating random number as template Jemm Excel Discussion (Misc queries) 2 July 6th 05 01:47 PM
Random number generator Philippe L. Balmanno Excel Worksheet Functions 4 December 17th 04 07:42 AM
Defining a number in a cell by text then subtracting it by the tex Crowraine Excel Worksheet Functions 1 December 16th 04 07:49 AM


All times are GMT +1. The time now is 12:17 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"