Randomly Choose Sample Rows After Using Autofilter
Nov 5, 2009
Can anyone explain clearly (using layman terms) about how to go about randomly choosing specific number of rows from a set of autofiltered records?
For e.g., If there are 1000 rows of data in a worksheet and after applying autofilter to certain column(s) [one or more] say i get some 75 rows. Then how can x no. of rows be chosen where x can be input by the user or calculated based on a certain percentage? Say if out of these 75 filtered rows, 8 rows have to be chosen randomly - where 8 can be input by the user or also be calculated as 10% of 75.
Also, is it possible to choose these x records from the filtered set of rows without actually copying them to another sheet?
View 12 Replies
ADVERTISEMENT
Mar 19, 2012
I have a work book.
In column C27 and down, the user can input a date.
In column M27 down, the user chooses pass or fail.
N8, contains a date chosen by user as the "From" date and P8 the "to" date.
Cell o11 is "Passed" and cell 012 is "failed"
The user can choose a date range and input the from and to date in N8 and P8, this will count the number of pass and fails and input the number in O11 and o12.
Formulas are below.
Code:
=COUNTIFS('Aff MFR'!C27:C1663,">="&'Aff MFR'!N8,'Aff MFR'!C27:C1663,"="&'Aff MFR'!N8,'Aff MFR'!C27:C1663,"
View 1 Replies
View Related
Oct 4, 2009
I've coded a macro that can randomly sample out rows of data from a sheet. This macro is used to sample out certain rows from a master sheet full of data (which has 48 columns) based on user names (a column titled LAST_UPDATE_NAME). For Example (ref. wkb attached), if for 5 users named Alastor, Catherine, Emma, Julie and Victor for whom i've to choose data from the Dump sheet.
I need to design a module in which if i input the no. of samples to be chosen against each name, then that many number of rows has to be chosen for that particular name and copied to a new sheet (probably such sheets can be renamed with the usernames). Also i want to consolidate the copied data from the multiple sheets and consolidate them to one sheet.
View 4 Replies
View Related
Dec 5, 2012
I have three columns of data that I want to randomly sort by row. It's important that each of the three adjacent cells in each row move together, i.e.
Before assortment:
A1 B1 C1
A2 B2 C2
A3 B3 C3
After random assortment:
A2 B2 C2
A1 B1 C1
A3 B3 C3
View 2 Replies
View Related
Oct 18, 2006
by what means is it possible to unselect randomly selected areas, rows, columns from all sheets?
View 4 Replies
View Related
Aug 7, 2007
If I create a pivot table, I'm able to click the arrow to the right on my row header, unselect "Show All" and then manually check boxes next to the rows I want to show. The pivot table then shows only the rows I'm interested in.
I can't figure out how to do this with filtering outside of the pivot table. I can select AutoFilter and then select "All", "Top 10" or individual rows, but I don't have the option to use a checkbox style selection to choose multiple, but not all, rows.
How can I set this up to have checkboxes associated with the AutoFilter dropdown so I can pick and choose which rows show?
View 9 Replies
View Related
Nov 15, 2009
I have a workbook that is used for storing test results that relate to people in different groups.
B4, C4, D4 are the surname, first name and group headings. This is what I want to filter by.
Column E is empty
F,G,H,I,J,K are the results.
Column L is empty
M is total of results
What I want to do is set an autofilter from B-L, only have drop downs on B,C,D. But in addition to this I want to have it that the range can dynamically change if another column of results is inserted.
To calculate my formulas in the worksheet I named/defined M4 as 'Total' so that I could then offset from this named cell to determine the range of test result columns, which works well. I just don't know how to do this in vba.
I have this to just get the autofilter running:
With ActiveSheet
.Unprotect ("password")
.AutoFilterMode = False
.Range("B4:L4").AutoFilter
.Protect ("password")
End With
I need the range to be B4: offset of the cell 'total' 0,-1
and I need to loop through from F - offset of the cell 'total' 0,-1 and turn the dropdown off on each of these headers.
View 9 Replies
View Related
Oct 23, 2007
I am trying to number col A from 1-??? with auto filter on. The only way I know how to do this would be to type 1 in the top col and drag it down, however when autofilter on, this doesnt work. Is there a way to do this, with or w/o VBA?
View 8 Replies
View Related
Jan 5, 2008
I use Excel 2007 and need to find the best way to delete rows selected after Auto-filter. This autofilter selects multiple criteria for a particular column. The closest post to do what I am looking for is: [url]
But this doesn't really help me firstly because it pops out an input box and asks to enter 1 criteria. I have multiple criteria for each column depending on which I'd like to delete rows.
Alternately, I have been trying this code belwow but its too time consuming for my 50,000 rows.
Sub CodeCleanup()
Dim r As Long
r = 65536
For I = 1 To r
If Cells(I, 30).Value = "R" Then
Rows(I).Delete
End If
Next I
End Sub
View 3 Replies
View Related
May 7, 2014
I have a spreadsheet that is split in two parts , one with headers in row 16 with data flowing down to row 190. In row 192 I have another set of headers with data flowing down from that to row 300.
I have a userform (roughly at cell B13 in the attached) that filters the first block of data into either Company, Syndicate, EU Corporate or ALL. (ignore the other filters) which feature in range B18:B190
What I want it to do, is that when one of the three options is selected, ie Company, is that all rows from 193 down are hidden other than those that are also Company (in the test case there is just one row). The same is true for when Syndicate or EU Corporate are selected in the userform, and if the ALL is selected then none are hidden.
View 2 Replies
View Related
Aug 5, 2014
I have a Userform that it makes possible to step through the the spreadsheet. It works with Previous and Next buttons. The Userform opens with a doubleclick. This works fine, but when I use an autofilter and the criteria reduces the number of rows, the Userform shows the hidden rows as well as the filtered rows. How could it be made that it only steps through the visible rows?
View 2 Replies
View Related
Jul 11, 2007
I have a Userform that allows you to step through the the spread sheet that works with Previous and Next buttons. This works fine.
When I use an autofilter where the criteria reduces the number of rows the Userform shows the hidden rows as well as the filtered rows. how can I make it just show the visible rows.
View 14 Replies
View Related
Jan 14, 2012
I have created a file where I use the Subtotal function. Once I collapse the information to only give me the Total, I would like to copy the Total rows into another worksheet. However, when I do this I get blank lines in between. I am trying to find a way to delete the blank rows in between the Total rows I need. Is there a way to do this with the auto filter function?
View 1 Replies
View Related
Jan 20, 2014
I have a spreadsheet with over 20000 rows of data and have used autofilter to find the information I want to check. Once I have these rows I want to check whether the cells in Column AE are higher/lower than the number (in this case '3'). Once it finds a cell that meets this condition then it copies and pastes the whole row so that I can review the entry.
The problem I'm having is that it doesn't work all the time. I've tested it a number of times in break mode & played it throughout and it works as expected, whereas other times it picks up the top row (header) and duplicates it or it picks up hidden rows and pastes them in sheet 2 if the condition is met. I want it to just pick up rows if they are visible (using the filter) if the condition is met.
Here's what I have so far:
Code:
Sub Lvl3v2()
'Level 3
Dim i As Integer
Dim r As Range
Dim c As Range
i = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
[Code] .........
View 2 Replies
View Related
Jun 17, 2007
Is it possible to use AutoFilter by Rows (with Orientation - Left to Right)?
View 9 Replies
View Related
Aug 24, 2004
I intend to create reports from a master sheet.
The master sheet contains company information; each row represents a (company)record.
The first column contains the country code where the company resides, e.g. DE.
I dug up this piece of
For i = 12 To 1 Step -1
Set rngAutoFilter = Cells(1, i)
rngAutoFilter.AutoFilter Field:=1, Criteria1:="DE"
Range(rngAutoFilter, rngAutoFilter.End(xlDown)).SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("Sheet2").Cells(1, i)
rngAutoFilter.AutoFilter
Next i
I found this code to work allright but, it only copies the singel cells containing "DE" and the topfirst row. At least that is what is the visible result.
How do I modify this code to copy EACH complete row containing "DE" in the first column?
View 9 Replies
View Related
Oct 3, 2007
I'm wondering if anyone has a answer to the problem of deleting all the rows that are hidden by an autofilter. We currently have a spreadsheet used within the office that catalogues all applications received, and we want to select all the applications that are relevant to a certain month with the autofilter and use a macro to delete those that are irrelevant, before emailing the spreadsheet to a client. Manually deleting all irrelevant rows would be time-consuming.
The current code I have is:
With Worksheets("Sheet1")
If .AutoFilterMode Then
With .AutoFilter.Filters(1)
If .On Then
Else: Rows.Delete
End If
End With
Else:
End If
End With
The theory is that the code first selects the relevant worksheet, determines whether autofilters are on, selects data that is being covered by the autofilter, indentifies those that is being displayed and does nothing, and identifies those which are not displayed and deletes them - in theory!
View 7 Replies
View Related
May 16, 2008
Is there a simple way to count unhidden rows? I saw Counting number of unhidden rows =SUBTOTAL(103,D11:D7180) and, frankly, I'm wondering if there is a way to do it without a formula. I don't need the count in a cell, per se, just a quick count of the unhidden rows of a worksheet for usage elsewhere.
View 5 Replies
View Related
Oct 10, 2007
I want to pull a sample of 15 numbers from column A, the catch is that the contents of column B cannot match once the sample is pulled. How do I do this.
View 9 Replies
View Related
Oct 25, 2012
I'm trying to filter and delete unwanted rows as I need row where dates is within a specified range.
How can I do this using AutoFilter? or are there any other alternatives?
View 2 Replies
View Related
Jul 12, 2014
I am trying to display a certain number of visible rows, using AutoFilter. My idea is to use a helper column that will 'number' each visible row, but I'm not quite sure what functions to use for this.
View 5 Replies
View Related
Dec 21, 2008
I have a spreadsheet in Excel 7 for a lifelong cashflow model. The main worksheet is called 'Projection' with ages in rows & income (from a variety of sources) and expenditure (of various kinds) in columns fed with data from the Input sheet.
On the 'Input' sheet I have a button called Format Graphs which controls the following macro:
View 6 Replies
View Related
Mar 19, 2012
I have a work book.
In column C27 and down, the user can input a date.
In column M27 down, the user chooses pass or fail.
N8, contains a date chosen by user as the "From" date and P8 the "to" date.
Cell o11 is "Passed" and cell 012 is "failed"
The user can choose a date range and input the from and to date in N8 and P8, this will count the number of pass and fails and input the number in O11 and o12.
Formulas are below.
Code:
=COUNTIFS('Aff MFR'!C27:C1663,">="&'Aff MFR'!N8,'Aff MFR'!C27:C1663,"="&'Aff MFR'!N8,'Aff MFR'!C27:C1663,"
View 1 Replies
View Related
Jun 18, 2009
I have 3 subs.
The 1st sub populates a series of sheets with data present in a master sheet called Overall. I'm using ADO because it's fast...
The 2nd sub loops through a range of criteria (also happen to be sheet names) and autofilters a range using the array items as the criteria. The filtered rows are then deleted (excluding headers).
The 3rd sub simply runs 1 and 2.
The 1st sub completes almost instantly.
The 2nd sub is also darn quick if I run it BEFORE the 1st (which is not as intended).
I have tried compliling both into a single sub and still the whole autofilter bit takes ages.
View 9 Replies
View Related
Mar 3, 2009
How to insert the sample mean symbol, so that the "bar" is centered over x?
View 5 Replies
View Related
Apr 24, 2013
I am working in excel 2007. I have been using the COUNTIFS function to pull out some summary stats from my data. For my data I have sample ID's which are a letter followed by a number e.g. A12, A20, A39, A50. I have 40 columns of variables I am looking at which for each sample ID have either a value of 0 or a numerical number. For each column, I want to count firstly any samples that are greater than 0 (i.e. they have a numerical value) AND if the sample ID differs. This is because I have multiple samples per ID and so I want to know how many different ID's have a numerical value.
Is this at all possible in Excel? I do not know all of the functions very well, so I cannot find anything that will allow me to look at differences in the samples ID.
View 2 Replies
View Related
Jan 17, 2008
I am computing the average of anywhere from 5-10 numbers. When the numbers are not inserted there is nothing left in the cell. The problem is I get a value that is close to the average but not the real average. (Also the cells I am using are N37:Q41 for the first 5 samples which is constant the next 5 are not always constant W37:Z41) Here is the formula I am using:
=IF((W37="")+(W38="")+(W39="")+(W40="")+(W41=""),AVERAGE(N37:Q41),IF((W38="")+(W39="")+(W40="")+(W41=""),AVERAGE(N37:Q41,W37),IF((W39="")+(W40="")+(W41=""),AVERAGE(N37:Q41,W37:Z38),IF((W40="")+(W41=""),AVERAGE(N37:Q41,W37:Z39),IF(W41="",AVERAGE(N37:Q41,W37:Z40),AVERAGE(N37:Q41,W37:Z41))))))
I have the same problem with a standard deviation formula and the same group of numbers (I get something close but a few points off).
=IF((W37="")+(W38="")+(W39="")+(W40="")+(W41=""),STDEV(N37:Q41),IF((W38="")+(W39="")+(W40="")+(W41=""),STDEV(N37:Q41,W37),IF((W39="")+(W40="")+(W41=""),STDEV(N37:Q41,W37:Z38),IF((W40="")+(W41=""),STDEV(N37:Q41,W37:Z39),IF(W41="",STDEV(N37:Q41,W37:Z40),STDEV(N37:Q41,W37:Z41))))))
View 9 Replies
View Related
Apr 16, 2009
How you do use excel to calculate a sample size using the population, error limit, confidence level and upper error limit rates?
View 9 Replies
View Related
Dec 5, 2009
I have an excel sheet with the following sample data on it.
Name Age Sex Height
Ray 33 M 5' 8''
Sind 29 F 5'4''
Ralph 3 M 2' 1"
Ryan 1 M 1' 2"
I have managed to extract this info onto a form named Form1 which has 4 list boxes in which the above info is displayed in the same format.
To be more precise
Listbox1 shows all the Names,
Listbox2 shows Age
List box3 shows Sex and
Listbox4 shows height respectively.
What i want to do is, When i select an item on Listbox1, all corresponding enteries on Listbox2, 3 and 4 should also be simultaneously highlighted,
For example if I select the third data Ralph on the ListBox1, then ListBox2 should highlight 3,
Listbox3 should highlight M and
Listbox4 should highlight 2' 1" simultaneously.
View 9 Replies
View Related
Sep 23, 2006
I have stored production data in Column A. I want 5 data randomly pulled from that column with click of a button. Would this Happen?. I have attached an excel sheet.
View 2 Replies
View Related