Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default URGENT- Random Sample per range of data

I am trying to create a function (?) that will allow me to get a specific
number of randomly selected cells out of a range. I know this is available,
but I can't seem to get it to do the following:

BACKGROUND- I have a spreadsheet that has employee names for the column
titles, and training module names for each row. The connecting cells
indicate the date which these training modules were completed [ex- Joe Shmoe
(column title) was training on Beancounting (row title) on 7/7/77
(coordinating cell data).]

PROBLEM- I need to randomly select 315 cells out of a range of
employees/training modules (for example, range B2-AF247). I know this can be
accomplished through the analysis tool, but I can't seem to get it to simply
HIGHLIGHT THE RANDOMLY SELECTED CELLS within the actual spreadsheet.
Instead, it seems to only pull the actual data out of the cells and throw it
somewhere else, which prevents me from having any reference as to the
employee and training module.

SOLUTION- ???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default URGENT- Random Sample per range of data

Sub ABCD()
Dim rng As Range
Dim rng1 As Range
Dim num As Long
Dim l As Long, i As Long
num = 315
Set rng = Range("B2:AF247")
rng.Interior.ColorIndex = xlNone
i = 0
Do While i < num
l = Int(Rnd() * rng.Count + 1)
Set rng1 = rng(l)
If rng1.Interior.ColorIndex = xlNone Then
rng1.Interior.ColorIndex = 6
i = i + 1
End If
Loop

End Sub


--
Regards,
Tom Ogilvy

"Another Jennifer" <Another wrote in
message ...
I am trying to create a function (?) that will allow me to get a specific
number of randomly selected cells out of a range. I know this is

available,
but I can't seem to get it to do the following:

BACKGROUND- I have a spreadsheet that has employee names for the column
titles, and training module names for each row. The connecting cells
indicate the date which these training modules were completed [ex- Joe

Shmoe
(column title) was training on Beancounting (row title) on 7/7/77
(coordinating cell data).]

PROBLEM- I need to randomly select 315 cells out of a range of
employees/training modules (for example, range B2-AF247). I know this can

be
accomplished through the analysis tool, but I can't seem to get it to

simply
HIGHLIGHT THE RANDOMLY SELECTED CELLS within the actual spreadsheet.
Instead, it seems to only pull the actual data out of the cells and throw

it
somewhere else, which prevents me from having any reference as to the
employee and training module.

SOLUTION- ???



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default URGENT- Random Sample per range of data

Tom,
I've learned how to apply the process, and it works fantastically, thank
you!!! I am now wondering if there's a way to list those selected boxes (NOT
the data contained in the boxes, but the actual cell #, such as A:220) in a
separate column on a separate spreadsheet.

"Tom Ogilvy" wrote:

Sub ABCD()
Dim rng As Range
Dim rng1 As Range
Dim num As Long
Dim l As Long, i As Long
num = 315
Set rng = Range("B2:AF247")
rng.Interior.ColorIndex = xlNone
i = 0
Do While i < num
l = Int(Rnd() * rng.Count + 1)
Set rng1 = rng(l)
If rng1.Interior.ColorIndex = xlNone Then
rng1.Interior.ColorIndex = 6
i = i + 1
End If
Loop

End Sub


--
Regards,
Tom Ogilvy

"Another Jennifer" <Another wrote in
message ...
I am trying to create a function (?) that will allow me to get a specific
number of randomly selected cells out of a range. I know this is

available,
but I can't seem to get it to do the following:

BACKGROUND- I have a spreadsheet that has employee names for the column
titles, and training module names for each row. The connecting cells
indicate the date which these training modules were completed [ex- Joe

Shmoe
(column title) was training on Beancounting (row title) on 7/7/77
(coordinating cell data).]

PROBLEM- I need to randomly select 315 cells out of a range of
employees/training modules (for example, range B2-AF247). I know this can

be
accomplished through the analysis tool, but I can't seem to get it to

simply
HIGHLIGHT THE RANDOMLY SELECTED CELLS within the actual spreadsheet.
Instead, it seems to only pull the actual data out of the cells and throw

it
somewhere else, which prevents me from having any reference as to the
employee and training module.

SOLUTION- ???




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default URGENT- Random Sample per range of data

Sub ABCD()
Dim rng As Range
Dim rng1 As Range
Dim num As Long
Dim l As Long, i As Long
num = 315
Set rng = Range("B2:AF247")
rng.Interior.ColorIndex = xlNone
i = 0
Do While i < num
l = Int(Rnd() * rng.Count + 1)
Set rng1 = rng(l)
If rng1.Interior.ColorIndex = xlNone Then
rng1.Interior.ColorIndex = 6
cells(i+1,"AH").Value = rng1.Address(0,0)
i = i + 1
End If
Loop

End Sub

Should list the cells in column AH

--
Regards,
Tom Ogilvy


"Another Jennifer" wrote in
message ...
Tom,
I've learned how to apply the process, and it works fantastically, thank
you!!! I am now wondering if there's a way to list those selected boxes

(NOT
the data contained in the boxes, but the actual cell #, such as A:220) in

a
separate column on a separate spreadsheet.

"Tom Ogilvy" wrote:

Sub ABCD()
Dim rng As Range
Dim rng1 As Range
Dim num As Long
Dim l As Long, i As Long
num = 315
Set rng = Range("B2:AF247")
rng.Interior.ColorIndex = xlNone
i = 0
Do While i < num
l = Int(Rnd() * rng.Count + 1)
Set rng1 = rng(l)
If rng1.Interior.ColorIndex = xlNone Then
rng1.Interior.ColorIndex = 6
i = i + 1
End If
Loop

End Sub


--
Regards,
Tom Ogilvy

"Another Jennifer" <Another wrote in
message ...
I am trying to create a function (?) that will allow me to get a

specific
number of randomly selected cells out of a range. I know this is

available,
but I can't seem to get it to do the following:

BACKGROUND- I have a spreadsheet that has employee names for the

column
titles, and training module names for each row. The connecting cells
indicate the date which these training modules were completed [ex- Joe

Shmoe
(column title) was training on Beancounting (row title) on 7/7/77
(coordinating cell data).]

PROBLEM- I need to randomly select 315 cells out of a range of
employees/training modules (for example, range B2-AF247). I know this

can
be
accomplished through the analysis tool, but I can't seem to get it to

simply
HIGHLIGHT THE RANDOMLY SELECTED CELLS within the actual spreadsheet.
Instead, it seems to only pull the actual data out of the cells and

throw
it
somewhere else, which prevents me from having any reference as to the
employee and training module.

SOLUTION- ???






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
Can I random sample from a set until every sample is selected? random sampling Excel Discussion (Misc queries) 6 April 26th 10 09:54 PM
Random Sample with multiple data points Jeremy Excel Worksheet Functions 1 April 21st 09 06:18 PM
can i do a random sample with non-numeric data? Kyeria Excel Discussion (Misc queries) 1 May 9th 07 10:51 PM
Selecting a Random Sample of 15 from a Large data set RMort Excel Worksheet Functions 6 December 22nd 06 05:09 PM
Is it possible to do a random sample of non-numeric data in Excel? Terri G Excel Discussion (Misc queries) 4 December 15th 05 05:44 PM


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