Loop Filter Criteria: Sheet Filtering It By Different Values
Sep 22, 2006
I'm looping through a sheet filtering it by different values. As of now I just have the same steps repeated 13 times. I want to do a loop instead. So my question is, how do I change the criteria of the filter? I want to perform the specific functions for each JD1 through JD13
Sub Full_S_BreakdownWIP()
jd1 = "FSC"
jd2 = "SA"
jd3 = "SC"
jd4 = "OA"
jd5 = "CA"
jd6 = "DC"
jd7 = "GCA"
jd8 = "PAR"
jd9 = "LG"
jd10 = "RA"
jd11 = "DM"
jd12 = "SR"
jd13 = "USA"
For i = 1 To 13................
View 4 Replies
ADVERTISEMENT
May 20, 2014
I have a worksheet that contains 3 columns, A, B, C, that I need to run through auto-filter and copy the results from a cell, F2, into another sheet each time the filter criteria changes.
Although the worksheet will contain over 11,000 rows (the attached sample file is trimmed down to around 1000 rows),
Col A will only have 8 different possible criteria for autofilter: 1,2,3,4,5,6,9,10
Col B has around 70 criteria, and Col C has around 700 criteria.
The number of rows in the sheet and consequently the auto-filter criteria will likely change each time (but will usually hover around these quantities).
As an example, here is how I would envision this working for Col C:
1. Starting on the 1st Sheet (named "FW15"), I auto-filter Col C on criteria/value 1
2. I copy the resulting value from Cell F2 of sheet FW15 and paste it into the first empty cell of Col C in Sheet 2 (named "CopiedResults")
3. I return to my first sheet, FW15, turn off the enabled filter for criteria/value, and turn on the next autofilter Criteria/Value of 2
4. Repeat Step 2
.
.
.
Keep looping through Col C to make sure that all auto-filter values have been applied, and all resulting values contained in Cell F2 are copied over to the second sheet.
Likewise, I would need to run through the auto-filter criteria in Col A and Col B, and copy their resulting values (from cell F2) into Sheet2 Col A and Col B.
Attached workbook : autofiltercriteria3.xlsx
View 2 Replies
View Related
Jul 30, 2014
I have a workbook that has the main user interface on sheet3 and the main database i'm trying to filter on sheet2. Sheet3 has the button that executes the code to open the worksheet with the database and filter based on certain criteria and will filter unique id if a numeric value is entered and surname if text is entered.
Originally this worked ok when i had the button and the' rcrit' cell reference on the same worksheet as the database i'm trying to filter, but i decided to move them to the interface page as it was interfering with other things i'm trying to do.
Ever since then i can't seem to edit it to make it work from the other page! I've tried changing the filter ranges to reflect the new set up, but it seems to no longer be able to recognise numeric/none numeric values.
here's the code I'm using.
VB:
Sub filter()
Application.ScreenUpdating = False
Dim rCrit1 As Range
[Code]....
View 2 Replies
View Related
Nov 14, 2009
I need to create report (just summing up) based on values in two different columns. I need a VBA to do it as the column values may vary at any time.
I have attached a sample workbook for your kind reference.
View 14 Replies
View Related
Apr 3, 2009
i had a database from which i need to extract data from COlUMN B, select the
View 2 Replies
View Related
May 21, 2014
I need to filter a large database using multiple OR criterias.
Database is CUSTOMER NAMES in each row with CONSUMED PRODUCTS following in each cell.
I want to filter two or more products and list customer names in sheet2. Like listing customers using salt or pepper Filter criterias will be entered into cells in sheet2 with results shown below and I want search to be active and alive just like vlookup function.
Sheet1
CUSTOMER NAMES---CONSUMED PRODUCT---CONSUMED PRODUCT---CONSUMED PRODUCT
GEORGE--------------SUGAR-----------------SALT
MICHAEL-------------PEPPER-----------------CHILI
JACK-----------------BREAD------------------SALT-----------------COFFEE
View 1 Replies
View Related
Jan 9, 2011
I looking for a macro that will go through multiple sheets & change specific cells to values if the column header is = to value set in specific cell.
for example
I would like the macro to look at row 3 in each tab (page 1, page 2, page 3) and if the value you is equal to X (parameter input on different sheet) then change the formula to a value in row 6 & row 12 of that column.
I'm attaching an simple example that i looking for this on. The green cells are the one i would like to change to a value.
Book1.xlsx
View 8 Replies
View Related
Dec 17, 2012
why the Advanced Filter works in the macro but not in the UDF?
Code:
Public Function strUniqueVal(rng As Range) 'rng variable must include sheet name
Dim c As Range
rng.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
[Code]....
View 2 Replies
View Related
Oct 5, 2008
I need to insert values from a column in one sheet to another sheet with a Loop mentioned here.
(I have attached a sample workbook for your kind reference.)
IN STATEMENT SHEET, I NEED TO INSERT (IN col F) THE VALUES from Col A of NOS sheet.THE INSERTION SHOULD BE LOOPED AS MENTIONED HERE
i.e. First time, it should be 1 to 10
Second time it should be 2 to 10 and 1
Third time it should be 3 to 10 and 1, 2
Fourth time it should be 4 to 10 and 1,2,3
Fifth time it should be 5 to 10 and 1,2,3,4…. And so on, till the last row with a value in ColA.
THE VALUES IN Col A of NOS Sheet MAY BE CHANGED WHENEVER REQUIRED. There it is 1 to 10, but it may be Alphabets or any other words also.
Hence, whatever values in Col A of NOS sheet should be taken for looping.
View 8 Replies
View Related
Jan 9, 2007
I need to filter a list without the use of the Auto Filter or arrays. I'm importing the list into Xcelsius which doesn't support these functions. I will need to do the filtering with functions.
View 9 Replies
View Related
Apr 5, 2014
What I would like to do is return the total qty of items on the 'QUOTATION' tab that are upholstery and this having been determined by whether there is a Y (for Yes) or N (for No) against the equivalent item in the 'BASIC_LIST' tab.
So in the below example, the total of Upholstered items would be 182 as items 'ST-11' to 'ST-13A - Tray' do not have a 'Y' against the matching item references in the 'BASIC_LIST' tab.
I would like this Y/N column to be the determining factor as opposed to any other criteria or filtering. (Also the Items column in the 'QUOTATION' tab is only ordered in the way it is for ease of view for this query!)
Picture 2.png Picture 3.png
SUM VALUES OF ITEMS THAT HAVE ALREADY MATCHED ANOTHER CRITERIA.xlsx
View 4 Replies
View Related
Feb 11, 2008
Is it possible to use an advance filter to detect blank cells? Or can the criteria be set to detect all cells that don't contain a letter e.g. "Y"?
View 3 Replies
View Related
Nov 7, 2013
I'm wanting to filter a set of data by inputting in to a cell. And it works perfectly...
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
If (Intersect(Target, Range("B4")) Is Nothing) _
Then
Exit Sub
End If
Cells.AutoFilter Field:=2, Criteria1:="=" & Range("B4")
End Sub
The only thing is I now need is for the code to clear the filter if the cell (B4) is blank. It currently filters out all the data if the cell is blank.
View 2 Replies
View Related
Aug 25, 2006
I have a list of a couple of thousand (and more) individual items. I want to filter the list and have a box for users to type in text (there are no numbers) and the results will be seen automatically reducing in number as more text is entered. (Similar to the Windows HELP files )
eg, typing A (or a) will show all entries beginning with A (without pressing
"Enter" or similar
typing AB will show only entries beinning with AB
typing ABO will show .........I guess you will understand the idea.
I have tried various forms of Filter - Auto and advanced - but still cannot get the spreadsheet to do what I want. Unless I am not doing the Autofilter (or Advanced filter) correctly (I am still a relative beginner!) I still cannot find a way of simply adding letters to a cell or input box and the filtering takes place 'automatically' as the letters are added.
View 8 Replies
View Related
May 1, 2014
I found a great bit of Advanced Filter code that works great, and fixed a problem of clearing a cell breaking the filter.
But if I want to increase the criteria from 1 row to 2, so you can start to include And , Or operations, it breaks the filter. Even an attempt at a manual one fails, until you put the criteria range back down to one row, then it's fine again.
I've tried changing the Target Row to >2 but that didn't work. how to make the criteria range bigger, and no problems of breakage if you clear the cells? It makes for a very useful automated Advanced Filter.
Here's the code :
[Code] .....
Database = the named area of raw data.
DATA is the name of the raw data worksheet
The criteria range should be AZ1:BC3, but of course royally breaks it...
View 4 Replies
View Related
Jan 15, 2014
I have a data set in Excel that starts with row 13 and has 26 columns. The headers are in row 12.
A pop-up user form requires the user to select from a drop down menu i.e Top50, Top100, Top200...
Once this is selected, the script below applies a filter to the header row & filters Column O based on the Topxxx chosen in the user form.
The script then selects the visible cells in selected columns from the data set and copies these to another sheet.
The only thing that changes is the filter criteria i.e the user-defined choice of Topxxx from the user form.
Obviously I would like to try and avoid having to copy copious lines of coding for each filter criteria i.e Top50, Top100 etc etc.
Code:
If UserForm1.ComboBox2 = "Top50" Then
Sheets("MD14").Activate
A9 = ActiveSheet.Range("A9").Value 'Counta
ActiveSheet.Range("A12:Z12").Select
Selection.AutoFilter
[Code] ........
View 1 Replies
View Related
Aug 3, 2014
There are 3 types of customers: A, B, and C. For different types of customers, there are different information needed to be filled in. For example, A customer need to fill in question 1,2,3 & 4 ; for B needs 1,2,3,4 &5; for C needs 1,2,3,4,5&6.
How can i:
1) create an advanced filter for selecting different types of customers
2) after selecting the customer type, the spreadsheet automatically generates the right questions?
View 1 Replies
View Related
Nov 25, 2008
One sheet will be where someone will be able to select the filtering criteria from a drop down box (ie. Industry, Company, Location, etc) then click an execute button.
Then the macro will go to the second sheet where all the data is, filter the data and create a new spreadsheet with the selected data.
I have been able to create a filtering macro on the data sheet but have not been able to place the macro on the first sheet and have the macro run correctly. I have attached the file.
View 2 Replies
View Related
Apr 1, 2013
I am creating a workbook with multiple worksheets. When row H on the first worksheet matches certain criteria, I want the whole row that this specific cell is in to copy to a separate worksheet of the same workbook in excel so that a list of these rows automatically compiles. How do I do this?
View 1 Replies
View Related
May 2, 2013
I have a database with 10 properties of a certain kind of material #.
IE: Material 1206 is Black, SG is 1.2, Duro is 70, Cure, tensile, price, etc.
I want a user to select 5 criteria from a drop-down list and have the 6th drop-down box populate available materials that meet the previous 5 criteria. I am trying to do this automatically and avoid user trying to autofilter (have to make it easy). I've extended the database out to show either a "0" or "1" if the 5 criteria match, but I can not get them into a drop-down list with a formula due to a #REF! error. I am not sure where the circular reference is coming from or what I have to do to change it.
View 1 Replies
View Related
Oct 20, 2013
Row H contains a date.
This date "example... 10/14/2013" Will always be a MONDAY
I am trying to figure out the code to filter out any Monday that is not of the current (changing) week.
View 5 Replies
View Related
Aug 21, 2007
I am using the following piece of code to 'link' a value from a cell in one workbook into another.
ActiveCell.FormulaR1C1 ="='[filepath]Front Sheet FIT'!r7c4"
However, i have come across a cell which displays the result of a reference to another cell (something simple like =b32). Normally I would just link to b32, however, the macro has to be applied to a large number of documents and in some cases text has been specifically entered, while in others the reference has been used. Is there any way of using VBA to display either the result of a formula (if there is one) or text if this is the case?
View 3 Replies
View Related
May 14, 2007
I need to display values from cells of sheet1 and sheet2 as comment in Corresponding cells of sheet3 whose value in sheet3 is FALSE
Sub try()
Dim Sheet1cellval As String, Sheet2cellval As String
Worksheets("Sheet3").Range("A1:D4").Select
Dim cell As Range
For Each cell In Selection
If Worksheets("Sheet3").cell.Value = False Then
cell.AddComment
cell.Comment.Visible = False
'Getting the value of Cell in Sheet1 for the corresponding cell in Sheet3 whose value is FALSE
Sheet1cellval= Worksheets("Sheet1").cell.value
'Getting the value of Cell in Sheet2 for the corresponding cell in Sheet3 whose value is FALSE
Sheet2cellval = Worksheets("Sheet2").cell.value
'Displaying the values of cells in Sheet1 and 2 as comment for the corresponding cells in Sheet3
Worksheets("Sheet3").cell.Comment.Text Text:="Difference" & Chr(10) & Chr(10) & "Sheet1: " & Reportcellval & Chr(10) & Sheet2cellval & Chr(10) & ""
View 2 Replies
View Related
Apr 1, 2014
Is there a way to provide filter with a list of criteria but when it doesnt match all of the criteria it still uses the filter on the criteria that it does match?
E.g i have this code
ActiveSheet.Range("$A$7:$N$31997").AutoFilter Field:=1, Criteria1:=Array( _
"A", "B", "D", "E", "H", "I", "R"), Operator:=xlFilterValues
However sometimes for example B will be missing, or H or B H I will be missing etc... is there a way to provide all of the criteria and it will not error if the criteria is not all there?
View 1 Replies
View Related
Mar 31, 2008
With Sheets("regrade pharm_standalone")
For Each r In .Range("standaloneTerritory")
If r.Value = "X101" Then
r.EntireRow.Copy
Sheets("X101").Range("A1").End(xlDown).Offset(1).PasteSpecial xlPasteValues
End If
Next r
End With
-------------------
I need to repeat this loop for values from X101 to X151. In all cases, the sheet name is equal to the value I'm looking up (eg: value = X102 goes to sheet X102).
I have a named range called 'territories' that contains the list of X101 -> X152.
I'm hoping to make the code perform the loop for each of the territories without my having to copy & paste and change the 'X101' 51 times as this would seem a rather silly thing to do!
View 9 Replies
View Related
Apr 15, 2008
I have spent a few days searching through forums but cannot find examples that i have been able to successfully adapt ( because they are to complicated for my limited knowledge). I have a workbook with 5 sheets, sheet1 (current), and sheet 4 (archive) are the important ones. I need a macro to
A) copy rows from "current" to "archive" ( to the 1st empty row) if column S of "current" contains "Closed" ( the word is generated by formula).
B) The paste needs to paste special values and number formats ( want to lose formula but not conditional formatting).
C) data sort "archives" based on col A - this puts the newly archived data into correct sequence.Data sort lowest number 1st
D) delete the copied rows from "current".
e) give me a count of how many rows it deleted, (I have a macro to insert rows so will run that manually to recreate the correct number of emtpy rows (with formula and formatting) to bring the current sheet back to usual size.
I tried modifying a macro by RPaulson (based on cells on one sheet to cells on another), to work with entire rows but couldn't get it to work.
Found that paste special uses PasteSpecial xlPasteValues, but , and thats about it.
View 6 Replies
View Related
Mar 4, 2014
I have an excel file with a table in it. It contains 2051 records (attached). This is just a sample, the original file has around 30,000 rows.
When I start using filters, I run into problems:
Step 1: Filter by Unit, condition (e.g.) Unit_23
Excel shows in the status bar the following message: 437 of 2050 records found.
Step 2: If I scroll to the bottom of the table, the row numbers are colored in blue (normal for a filtered list) however the last row is not colored and it actually should not be shown since its unit is not what I filtered for (its unit is Unit_25)
Step 3: Clear the filter of Unit
Step 4: Sometimes (depending on what I filter for), one or more of the bottom rows are hidden!!!
Attachment 301726
View 4 Replies
View Related
Mar 26, 2013
I have some columns on which I have a filter, with some columns next to those that have information in them.
What I need to do is filter only columns A-F when apply filter values, but keep columns I-K fixed as A-F change when they are filtered..
View 1 Replies
View Related
Mar 8, 2012
Is there a simple way to loop through and filter the values in col1, then save it to a file named by the filtered value? Would be good if it could keep all the formatting as well.
View 1 Replies
View Related
Jan 13, 2010
either writing a formula or coming up with some way to filter out certain values and it's stumping me... it's probably way more simple than I'm making it I've got an attendance spreadsheet with employee names going down the first column and dates going across the top row, managers use codes to indicate sick, personal time, etc.
There is a separate spreadsheet for supervisors to track vacation (don't ask me why) and I was asked to link the data from that spreadsheet into the attendance one described.
Linking is no problem, since it's the beginning of the year I'll just do a copy & Paste special.... paste link and they can still use that 2nd vacation spreadsheet to update both places for vacation time. However.... the vacation sheet has some extra info they don't need/want to see on the attendance one (ie. Lv @ 12:30, Holiday, etc.) How can I filter that out so that the only thing that appears is the V for Vacation that is linked & other attendance codes that are entered (S for Sick, etc).
I'm using Excel 2007
View 14 Replies
View Related