Advanced Filter With Function As Criteria Range
Feb 27, 2008
I have a worksheet with 6000 rows (W1), and another with 2500 rows (W2).
I need to check whether the values of W2 are found in the second column of W1. As in if(iserror(search(valuex,worksheet2!B2)),"",A2) ---> resulting in something like:
If the value is found in the cell B2 of column B on W1, then return its reference which you find in A2, otherwise leave a blank.
I need to check all 2500 values in all 6000 rows.
I know for sure that I will have limited hits (max of 200) so I would like to create a list on W2 (the values) where I check if they are found in W1 and return only the 'hits'. I would like to filter out the blanks.
YOu can filter the blanks, I know, but you need to have a 'full' version (I thought) with all the blanks and the hits and then and only then you can filter.
But is there a way how I can use the advanced filter, with a criteria range using a function. Something like: criteria range --> if(iserror(search(valuex,worksheet2!B2)),"",A2) is not equal to "".
View 14 Replies
ADVERTISEMENT
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
Jun 12, 2008
When doing advanced filter in VBA, is there a way to set the criteriarange, without having actual cells on a worksheet with the criteria in?
I've tried criteriarange:=Array("Currency", ws.Name), but it didn't like it.
View 9 Replies
View Related
Aug 12, 2006
I m Playing around with AdvancedFilters. Using the code below I can filter for data in the CriteriaRange, but I want to filter for data not in the CriteriaRange. I can't seem to find out to do this. I'm wanting to execute this sub from a button on a userform.
Sub Filter1()
Range("Data").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("CRng"), Unique:=False
End Sub
View 8 Replies
View Related
Mar 5, 2014
Can I use vba advancedfilter to work with more than one criteria?
I presently have one range designated. At the top cell has the field, or column, header name being "Student", then followed by a list of 6 people, located in Sheets("Extract").Range("A1:A7"), which is then extracted from Sheets("Complete").Range("tblPrimary[#ALL]") to Sheets("Extract").Range("AA1") as in:
[Code] ......
I want to also be able to filter out a specific month, whose field/column name just happens to be "Month", but I suspect I will need to change it to "InfoMonth" or the like to avoid the probable key word of "Month"...
The months are numerical in those fields - 1 through 12.
Can I add to the present filtering line or do I need to then create an additional filter?
View 6 Replies
View Related
Oct 25, 2011
I'm trying to use an advanced filter to filter a large data set using several parameters. I had this worked out before but there have been some parameters added that have thrown my filter off balance and I'm struggling getting it back.
Here's the criteria I need to filter
Column 1:
85
Column 2:
3
Column 3:
BU 1
BU 2
BU 3
BU 4
Column 4:
BA 1
BA 2
BA 3
BA 4
BA 5
BA 6
BA 7
Since I have an uneven list of criteria, I'm struggling to figure out the layout with the 'AND' condition. I know I can copy the 85 and 3 figures to each line but when I have 4 figures in column 3 and 7 figures in column 4, how can I create the 'AND' condition for all these criteria?
View 2 Replies
View Related
Feb 7, 2012
I have a list of farmers in A1:A1000 with the types of livestock they keep in col B, delimited with commas and spaces e.g:
Col A Col B
Name Animals
Smith Cows, Pigs, Sheep, Horses
Jones Sheep, Pigs, Chickens, Geese, Alpaccas
Price Cows, Sheep, Pigs, Chickens, Rabbits
Williams Cows, Chickens, Horses, Alpaccas, Pigs
I need to be able to filter this list using up to 3 criteria, e.g. Filter all farmers with Cows, AND Sheep, AND Pigs. Applying this to the data above would show Smith and Price.
The user would need to enter the criteria somewhere, preferably in 3 cells, let's say D1, D2, & D3. I reckon I need to use Advanced Filter, but not sure how to do it with all the animal types to be filtered being in one column.
View 2 Replies
View Related
Jan 11, 2013
as u can see on picture I have some data and i want it to filter with "debet" and "credit",while debet can be zero or number x when in the same time credit can be zero or the same number x so when entering number x meaning e.g. 500 i get to rows
first
debet = 0 and credit = 500
second
debet = 500 and credit = 0
while running advanced filter i was getting nothing because i couldn't write what i needed
View 5 Replies
View Related
Nov 19, 2007
I'd like to ask if there is anyway to use an advanced criteria with a NOT EQUAL operator.
I have a list that contains about 50 different data values that I want to filter but I want to restrict the list to not contain four different data items. Clearly, autofilter did not work as I can only specify two conditions in the custom filter. I want to use advanced filter instead but this only tests for equality.
View 3 Replies
View Related
Dec 5, 2008
I have an Excel sheet with a few thousand rows which I would like to filter by a column with the name TrackingID. This column contains values like:
12AA1
23452BA2
234AA1
345635CA2
...
I would like to filter this column by the third character from the end (which is always a letter from the range [A-Z]). In the example above, this would be:
A
B
A
C...................
View 2 Replies
View Related
Jun 16, 2014
I think to run one report. First sheet put options and copy to data page as criteria, and run advanced filter, it only shows heading.
VB:
Sheets("Report").Select
Range("23:350").Delete
Sheets("Details").Select
Range("w8:ae9").Copy
Range("w12").Select
[Code] ......
View 2 Replies
View Related
Jan 7, 2010
I cannot work out the syntax to run an advanced filter for all Non-Blank Columns! I have attached an example sheet, and you can see my syntax in cell D4. I am looking to bring through a list of all line that are both Status= "NOT QUOTED YET" and Project Name= NOT Blank. Unfortunatley, the Status Row will be set as NOT QUOTED YET when there is no project name enetered, hence the problem.
View 2 Replies
View Related
Mar 27, 2007
attached is a spreadsheet effectively replicating a criteria box I’m using to do an advanced filter on a large amount of data (5000+ lines). The criteria can be anywhere from 1 to 7 different lines. What I’m trying to achieve is code that will look at the specified criteria box, determine how many rows of criteria actually exist, and then use that code to perform the advanced filter function on the data.
Below is the code I’ve put together so far. The problem is that this code can only determine that there are 7 total rows of criteria to use, and not the exact number of rows of criteria. For instance, say I only wanted to use 2 rows of criteria, I’m hoping the macro would only use those 2 rows instead of picking up all 7 rows.
See criteria box on spreadsheet for example. In this particular example, I’m wanting the macro to only use B49:I51 as criteria. The ideal solution would be for the macro to look at the criteria box and determine the last row used that is not filled with “1”s. Does anybody have any thoughts on ways to tweak my code to get it to achieve this?
Sub RunDynamicSelection_Click()
Dim wsSheetDS As Worksheet
Dim wsSheetRS
Set wsSheetDS = Worksheets("DataSheet")
Set wsSheetRS = Worksheets("ReportSelection")
With wsSheetDS
.AutoFilterMode = False
With wsSheetDS. Range(("A4:N4"), wsSheetDS.UsedRange.Rows(Worksheets("DataSheet") _
.UsedRange.Rows.Count)).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _....................
View 2 Replies
View Related
Feb 8, 2012
At work, I have a workbook with multiple tabs that contain lists. Each tab has a corresponding Pivot Table.
There is a business requirement that a user can specify a name, which filters the data. For the sake of simplicity use this for an example
Column Headers: First_Name ; Last_Name; Age
Row 1: Johnny; Bravo; 29
Row 2: Shane; Falco; 34
Row 3; Bobby; Shane; 15
The user specifies "Shane" as the filter in another pre-determined Cell (D1). Using advanced criteria, I need to find all rows that have Shane in either First_Name or Last_Name. The only way I know how to do that is inserting two rows and adding criteria:
First_Name ; Last_Name; Age
=D1; ;
;=D1;
Johnny; Bravo; 29
Shane; Falco; 34
Bobby; Shane; 15
With Criteria Range = "A1:B3"
This is problematic because my Pivot tables now include 5 rows of data.
View 3 Replies
View Related
Nov 2, 2008
I am trying to use an advanced filter to extract records that meet the criteria in the blue input cells. I can't get the criteria correct to allow me to meet the 3 conditions. There are duplicate names in the list so I will need to use unique records only option....
View 9 Replies
View Related
Nov 25, 2009
I have a advanced filter that works pretty much close to how I want it to. However I would like it to either cancel the new filter or copy everything if it finds 0 matches.
If the copied location is blank it breaks my sheet. So I need to find a way for it to never be blank, either by canceling it, copying everything, or finding some other way I haven't thought of.
Also for some reason my Advanced Filter does NOT Ignore blank "OR" cells. If I place a word in the top cell, then leave the bottom blank, it searches for the top cell or anything and I end up with everything. Its quite frustrating.
View 3 Replies
View Related
Sep 11, 2006
Im using an advanced filter that uses the following criteria
Days Late Note(s) Note(s)
>90 <>*agreement* <>*QTR*
This shows all data over 90 that do not incl the words agreement or QTR in a column marked Note(s).
My problem is that I do not want to show records that are Null in the Note(s) column.
Note(s)
<> Does not work (possibly because it is text and not Numbers)
as this does work if used on records that contain numbers.
View 9 Replies
View Related
Jun 28, 2014
I'm working with many rows of data (500,000+) and many columns. To simplify my question, I'm going to provide a simple example using made up numbers and only the columns I'm concerned with.
BillT Doc.ItemQty
F11231012.00
F2123205.00
S1123105.00
RE321202.00
F2321108.00
F2321201.00
RE321203.00
RE999808.00
F27771001.00
RE7771001.00
I am trying to remove the docs that have two Bill types that cancel each other out, where the qtys match and highlight the rows where the qtys don't match. The macro needs to have the positive and negative bill types programatically entered, where for example F1 and F2 are positive and S1 and RE are negative. Keep in mind the data may not necessarily be in order as it is above.
So for example with data above, the rows for doc 777 would be removed completely because the item numbers are the same, the qty is the same, and the bill types oppose each other. Doc 123 and Item 10 lines should be highlighted since their bill types are opposed bu their qtys don't match.
I hope this makes sense. I tired to achieve this using multiple loops and arrays, but ran out of memory when working with the entire set of data. I'm assuming their must be a better way to do this, I'm hoping some of the intelligent individuals here will be able to point in the right direction.
View 8 Replies
View Related
Jul 28, 2006
I am writing a VBA code to make an advanced filter. Instead of a fixed criteriarange, I would like it to be dynamic. As each time the number of criteria is different.
e.g.
Range("A1:G30").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("L1:L18"), Unique:=False
I want the criteriarange to change. e.g. It include all the data if I put in 20 data in col L.
View 2 Replies
View Related
Oct 16, 2013
I thought I had this cracked last month when I ran a set of reports using some code dependent on using advanced filters to first create a unique list to loop through and then to create a list of all entries in a list for each unique entry. The idea being that I extracted all the data for each unique entry in the list and saved that to a new workbook, named after the unique entry.
However, this month I'm totally flummoxed again. I can't seem to get even the first part, creating a unique list, to run.
I have a sheet with several thousand rows of data with maybe 25 columns. I have the following code to try to extract the unique entries in the 2nd column, column B and store them in the same worksheet in column AD, to use when looping through the list.
VB:
With ActiveSheet
.Range("AD1").EntireColumn.Delete
.Range("A1").CurrentRegion.Columns(2).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheet1.Range( _
[Code].....
View 9 Replies
View Related
Nov 7, 2012
I've got a spreadsheet where I run a macro to Advanced Filter results from a "Register" sheet to a "Search" sheet. Macro is run from the Search sheet. Existing code looks like:
Code:
Sheets("Register").Range("A9:Z10000").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Register").Range("A3:W4"), _
CopyToRange:=Sheets("Search").Range("A26:X26"), _
Unique:=False
At the moment the macro filters the range down to row 10,000. I need to adapt it to a variable number of rows in case they go over 10,000. Currently I am using a Do loop to find the bottom of the list by having it check the one column out of 26 that will always have data in it (Column D)
Code:
rfRegisterStarts = 10
rfRegisterRowCounter = 0
Do While IsEmpty(Sheets("Register").Cells(rfRegisterStarts + rfRegisterRowCounter, 4)) = False
rfRegisterRowCounter = rfRegisterRowCounter + 1
Loop
Therefore the range of my table to be filtered including header row is:
Range(Cells(rfRegisterStarts - 1, 1), Cells(rfRegisterStarts + rfRegisterRowCounter, 27))
My problem is that trying to change the Range object in front of .AdvancedFilter causes all sorts of errors. I've tried:
Code:
Sheets("Register").Range(Cells(rfRegisterStarts - 1, 1), Cells(rfRegisterStarts + rfRegisterRowCounter, 27))
.AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Register").Range("A3:W4"), _
CopyToRange:=Sheets("Search").Range("A26:X26"), _
Unique:=False
OR
Code:
Dim rfRegSelect As Range
Set rfRegSelect = Range(Cells(rfRegisterStarts - 1, 1), Cells(rfRegisterStarts + rfRegisterRowCounter, 27))
rfRegSelect.AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Register").Range("A3:W4"), _
CopyToRange:=Sheets("Search").Range("A26:X26"), _
Unique:=False
With almost every combination of
With Worksheet("Register") or Sheets("Register") I can imagine
Why I'm getting these errors? Is Advanced Filter just really finicky?
View 3 Replies
View Related
Jun 7, 2006
I am trying to create an advanced filter that filters my results into a row.
e.g.
Shane
Shane
Tom
Tom
Paul
Mike
would return
Shane Tom Paul Mike
I have tried changing this piece of code
Range("M1:M300").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Columns("M:M"), CopyToRange:=Rows("25:25"), Unique:=True
The problem is with
CopyToRange:=Rows("25:25")
I have tried using Range instead of Rows but I am not having any joy.
View 4 Replies
View Related
Dec 6, 2013
I would like to only view (or otherwise mark) the highest value cells (in column g) for each category (column c),
View 3 Replies
View Related
Jun 14, 2009
Can anyone explain why the unique filter does not produce a unique result - sample attached?
View 2 Replies
View Related
Jan 14, 2010
How do I go about using an advanced filter to filter a list of data e.g.
boat
boat
boat
car
car
truck
and have the filter extract only the boat entries to another worksheet, so on another worksheet I end up with
boat
boat
boat
View 9 Replies
View Related
Mar 15, 2007
1- Force cell format date to by (yyyy/mm/dd) only, with worng msgbox( validation).
2- Make the first day of a month in a color cell
I've Tried this In Conditional Formating (=VALUE(right(A1;2))=1) but didn't work
3-Make Advanced Filter to filter data between two dates .
View 5 Replies
View Related
Sep 9, 2012
I have following data to sort/filter
Sector
Flt no
origin
[Code]...
Is this possible with excel functions?
View 1 Replies
View Related
Jun 1, 2008
i want to display the results of one criteria using VBA codes instead of just filtering one by one to display the result and collate it. I have attached the sample. I want to find the "subcodes" of name "kathy". to be able to do that, i filter "kathy" to display all the "codes" then filter all the "codes" to find the "subcodes". is there vba code for this one so that when i input the name, all the subcodes will be displayed?
View 6 Replies
View Related
Apr 8, 2014
I have a large Excel with details of 1,000 staff
Column J1 is called: Resource Name which has 1,000+ staff other columns have corresponding Hours, Project names etc
I want an advanced filter where I select COLUMN J:J and filter this whole sheet based on say 25 names (in the format they're in) e.g
Frank, James
Wilkonson, Paul,
etc
In the Advanced Filter, Ive selected J:J as LIST RANGE, but how do I input an OR statement in the Criteria, as above i.e where name is Frank, James OR Wilksonson, Paul OR
Alternatively, I have the list of the 25 names in Sheet 2, can the Advanced Filter do a VLOOKUP then filter entire Sheet based on the names provided?
View 11 Replies
View Related
Aug 5, 2014
I have a condition in advanced filtering as >90%. However, I would like the "90%" to be calculated via a formula in another cell and this condition to reference it. Is it possible?
View 8 Replies
View Related