Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sort and delete for a random sample?

All,

I have a repeating scenario I would like to automate.

Monthly I get a spreadsheet with about 30,000 rows by 8 columns. All
Accounts Payable invoice data.

One of the columns (column 'D') contains the initials of a data entry person
that originally entered the data. I need to create a 10% random sample of
each data entry persons work. There are about 12 different people that key
in data that ends up in this spreadsheet.

Manually, I would sort by column 'D' , insert a column and apply a random
function, manually count the quantity of rows per data entry persons
initials and take 10% of that quantity and delete the rest of that persons
rows. Then move on to the next persons initials.



Any help is appreciated!

Jay


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort and delete for a random sample?

Hi JayL,

Below is a file called 'Jayl.zip'. If you unzip it you will find a file
called 'JayL.xls'. Have a look through it and see if it is what you
need.

Regards
Zantor

File Attached: http://www.exceltip.com/forum/attach...?postid=285781 (jayl.zip)

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sort and delete for a random sample?

Zantor,

tried to download the file but got an error message 'Attachemnt not
specified'. Feel free to send it to my email address .

Thanks!
Jay


"zantor" wrote in message
...
Hi JayL,

Below is a file called 'Jayl.zip'. If you unzip it you will find a file
called 'JayL.xls'. Have a look through it and see if it is what you
need.

Regards
Zantor

File Attached:
http://www.exceltip.com/forum/attach...?postid=285781
(jayl.zip)

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Sort and delete for a random sample?


To insert the random numbers between 0 and 9
as a new column then make a pivot with the counts by
Typist and random nummber.

Doubleclicking on a cell in the pivot, where the count
will create a sheet with the relevant lines for that typists/random
detailslines.

Th macro assumes a sheet called data and a sheet
called report, where the pivot will be created.

Suc6


Sub PivotForRandom()
Dim heads, itm

'Fill columni with random numbers (values)
With Worksheets("data")
.[i1] = "Random"
With .Range("i2:i" & [a65536].End(xlUp).Row)
.Formula = "=int(rand()*12)"
.Formula = .Value
End With
End With
With ActiveWorkbook
.Names.Add "dnPivSource", _
"=OFFSET(data!$A$1,0,0,COUNTA(data!$A:$A),COUNTA(d ata!$1:$1))"
.Worksheets("report").Cells.Clear
With .PivotCaches.Add(xlDatabase, "dnPivSource")
.CreatePivotTable [report!A3], "Pivot1"
End With
End With

heads = [dnPivSource].Resize(1)
With Worksheets("report").PivotTables(1)
For Each itm In .VisibleFields
itm.Orientation = xlHidden
Next
.AddFields Array(heads(1, 4)), _
Array(heads(1, 9))
.AddDataField .PivotFields(heads(1, 1)), "Count", xlCount
End With

End Sub







keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"JayL." wrote:

All,

I have a repeating scenario I would like to automate.

Monthly I get a spreadsheet with about 30,000 rows by 8 columns. All
Accounts Payable invoice data.

One of the columns (column 'D') contains the initials of a data entry
person that originally entered the data. I need to create a 10% random
sample of each data entry persons work. There are about 12 different
people that key in data that ends up in this spreadsheet.

Manually, I would sort by column 'D' , insert a column and apply a
random function, manually count the quantity of rows per data entry
persons initials and take 10% of that quantity and delete the rest of
that persons rows. Then move on to the next persons initials.



Any help is appreciated!

Jay




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 Funkyfido Excel Worksheet Functions 2 September 22nd 08 11:09 AM
How do I make a random sample? Confused student Excel Discussion (Misc queries) 4 April 25th 08 04:12 PM
random sample skimpw Excel Worksheet Functions 0 August 15th 06 01:15 AM
Random Sample Without Duplication beccadawn0622 Excel Discussion (Misc queries) 3 January 25th 06 02:13 PM


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