Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Willie
 
Posts: n/a
Default Selecting Random Data

I have a spreadsheet that has data in A1:J4163 but the size is not always the
same.
My question: Is there a way that I can make a formula, VBA or Contitional
formating to select rows randomly and color fill the rows




  #2   Report Post  
Gary L Brown
 
Posts: n/a
Default

use a cheat row with the formula...
=INT(RAND()*10)+1
where '10' is the range of random #s generated (1-10).
Then create a conditional format that says
Cell Value Is...Equal To...5 (I randomly chose the # 5 for this example :O)
This will only highlight the randomly generated #5 - about 10% of the rows.
Change the '10' to 100 and only about 1% of the rows will have the randomly
generated #5 and therefore meet the conditional formatting criteria.
HTH,
--
Gary Brown

If this post was helpful, please click the ''''Yes'''' button next to
''''Was this Post Helpfull to you?".


"Willie" wrote:

I have a spreadsheet that has data in A1:J4163 but the size is not always the
same.
My question: Is there a way that I can make a formula, VBA or Contitional
formating to select rows randomly and color fill the rows




  #3   Report Post  
Gary's Student
 
Posts: n/a
Default

For a VBA solution look at the following:

Sub Color_It_Yellow()
Dim How_Many_Rows_Am_I_Using As Long
Dim How_Many_Should_Be_Colored As Long
How_Many_Rows_Am_I_Using = 25
How_Many_Should_Be_Colored = 10

Dim rws(65536) As Long

For i = 1 To How_Many_Should_Be_Colored
rws(i) = Rnd() * How_Many_Rows_Am_I_Using + 1
Rows(rws(i)).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Next i
End Sub
--
Gary's Student


"Gary L Brown" wrote:

use a cheat row with the formula...
=INT(RAND()*10)+1
where '10' is the range of random #s generated (1-10).
Then create a conditional format that says
Cell Value Is...Equal To...5 (I randomly chose the # 5 for this example :O)
This will only highlight the randomly generated #5 - about 10% of the rows.
Change the '10' to 100 and only about 1% of the rows will have the randomly
generated #5 and therefore meet the conditional formatting criteria.
HTH,
--
Gary Brown

If this post was helpful, please click the ''''Yes'''' button next to
''''Was this Post Helpfull to you?".


"Willie" wrote:

I have a spreadsheet that has data in A1:J4163 but the size is not always the
same.
My question: Is there a way that I can make a formula, VBA or Contitional
formating to select rows randomly and color fill the rows




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 do I compare 2 sets of data and highlight differences? Perplexed1 Excel Worksheet Functions 1 July 9th 05 01:15 AM
How do I import formmail data to a custom excel template? cxlough41 Excel Worksheet Functions 1 July 1st 05 12:59 AM
Adding more source data to existing scatter plot Tom Charts and Charting in Excel 1 March 21st 05 10:03 PM
Running Data Table using an input that triggers DDE linked data [email protected] Excel Discussion (Misc queries) 1 December 16th 04 11:56 AM
selecting and listing data Brian Excel Worksheet Functions 9 November 9th 04 06:55 PM


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