Macro For Filters With Exceptions?
Jan 20, 2010
I am using Excel 2007. I have a list of 100 names all ranked from 1-100. Is there a way to create a macro that can filter out the top 20, a specific name and also any names with the cell colours blue and yellow?
At the moment using an advanced filter based on criteria I can filter out the top 20 and the specific name I want but can't work out how to leave the coloured rows in as well.
View 3 Replies
ADVERTISEMENT
Jun 7, 2006
I have a problem with the attached spreadsheet. I have certain letters (A,B,C etc.) that are shipped to various regions. I would like to have a count on top to count the total number of orders, but one that also counts the total number of unique orders. However, this unique count has to be dynamic and must be able to adjust accordingly to the filters (by default, if no other filters are applied, should be 15). For example, if I apply the "Ship To" filter to Canada, the total number should be 19, but the unique count should be 12. If I change the "Ship To" filter to US, the total number should be 9, and the unique count should be 7. I've tried to use the advanced filters but if I apply the unique entries filter, it is only a one time calculation. Also, the advanced filter gets rid of my other filters.
View 5 Replies
View Related
Jun 20, 2014
I have a pivot table with various filters, and I would like to setup a macro assigned to a button which resets the filters to 'All'. Used this code to clear one field and it worked successfully:
Code:
Option Explicit
Sub ClearFilters()
'
' Clear Filters
ActiveSheet.PivotTables("FLIGHTS") _
.PivotFields("MONTH").ClearManualFilter
End Sub
The question that I have is: how can I list the other fields in the same macro, or is there a command that just resets all available field so they don't have to be listed individually?
View 4 Replies
View Related
May 29, 2007
I need to use the Advanced Filter tool to allow the user to filter (in-place) the Guests worksheet while providing the following summary stats: total revenue, ave. revenue, max/min revenue and total number of tours ie the user should be able to enter any criteria below the database to to show only those records (and summary stats) that satisfy the criteria.
To automate the operation of the advanced filter tool, I need three macros. "SelectRoom" and "SelectGuest" macros should prompt the user to enter a value through an input box to filter the data according to a client's name or language tour. The third macro, called "ShowAllGuests" should clear the criteria row and dispay all clients in the database.
The first two macros should include an error message to prompt the user to rerun a macro if no clients satisfied the criteria while the "ShowAllGuests" macro should include a message box statement at the end to display a short message giving credit to the macro author. These macros also require a button each (three in total) in the Guests worksheet!
View 3 Replies
View Related
Jun 23, 2014
I am working on a complicated macro. The macro is suppose to move certain data set to a specific worksheet if an if statement is "True."
As of now the macro, inserts the row into a new sheet but it is inserted into Row 1. My data set is in Sheet A is up to Column U and I want it to be inserted in Column B on Sheet B. The code below inserts the entire row into Sheet B starting with column a.
[Code] ........
This variation of the code moves the entire data set from Sheet A to Sheet B and inserts it in Column B as wanted, but it does NOT follow the Criteria of "true", it brings the entire data set even those with "False".
[Code] ..........
View 1 Replies
View Related
Feb 28, 2007
I have a mixed list of materials in column 'A'. I have two macro/filters to extract (copy/paste)... one for those ending in "[G]", and one for all others (those not ending in"[G]"), to columns 'B' & 'C' respectively. The code looks like this;
Sub Filter_G()
Range("B2:B" & Range("B65536").End(xlUp).Row + 1).ClearContents
Range("A2:A" & Range("A65536").End(xlUp).Row + 1).Select
Selection. AutoFilter Field:=1, Criteria1:="=*[G]"
Range("A2:A" & Range("A65536").End(xlUp).Row + 1).Select
Selection.Copy
Range("B2").Select
ActiveSheet.Paste
Range("B2").Select
Selection.AutoFilter.......................
View 5 Replies
View Related
Jan 30, 2009
the following code filters data and copies to worksheets specified in code, can this code be shortened to make the macro run faster. Also in my second criteria how can I put "Contains "PT2" in the criteria as nothing happens when i run the macro, is *PT2?
With shtRec
.AutoFilterMode = False
.Range("A7").AutoFilter Field:=8, Criteria1:="LEHMAN", Operator:=xlAnd
With .AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.Count - 1).Offset(1).SpecialCells(12)
On Error GoTo 0
End With
If rng Is Nothing Then
MsgBox "No data to copy"
Else
rng.Copy shtLehman.Range("A6")
End If
.AutoFilterMode = False
End With
View 9 Replies
View Related
Aug 22, 2008
I have a pivot table with over 4000 entries and about 12 columns which i filter to get the info i want.
Unfortunately with so many rows and columns in the table, if i do a macro that gets each filter back to 'show all' its really slow.
Doing this manually using the "Show all" option in the filter takes a fraction of a second, so surely there must be a way to do this more quickly in VBA?
i can't understand why manually it takes no time at all, but automating it through recording a macro takes forever.
View 9 Replies
View Related
May 29, 2013
I've got an old Excel sheet with Stephen Bullen's function for returning the active filter criteria (Rob on Programming: Excel: Displaying Autofilter Criteria). My status sheet may be filtered in multiple ways, and when the user is happy with the filter selections, she can create a powerpoint file with a graph and a summary of the filtered table. As we are using Excel 2010, users are very likely to select more than two filters.
Example: Range A1:E100 has the following headers: Field, Installation, Project,Type, Phase.
The controller wants to filter on:
Field equals north or south or west Phase equals completed
The manager for Field South wants to filter on:
Field equals southType equals maintenance or repair or modification Installation begins with Zeus.
As the filters are not shown when I copy the table to powerpoint, I would like to create a summary of the user's active filters that is pasted into a sheet (for subsequent copying to powerpoint). For the users in the example above, that table would look something like this:
Controller:
Active filters
Field: north, south, west
Phase: completed
Manager, Field South:
Active filters
Field: south
Type: maintenance, repair, modification
Installation: Zeus*
I've looked at various functions intended to take Stephen Bullen's code into Excel 2010's multiple criteria world (e.g. this: User Defined Function to Display AutoFilter Criteria for More Than Two Criteria in Excel 2007 / Excel 2010), but I have not been able to convert it to a functioning macro.
Any code that could be used for this sort of task, or any tips for relevant code?
View 2 Replies
View Related
Feb 28, 2014
To establish the order for on duty personnel every month, I need to find a proper formula.
I have attached the workbook.
So, when I pick out a month from a drop list in cell A1, in column B returns (based on a formula) net work days of that month.
In range H:T, I have a table with the personnel names (in the header) and the individual holidays.
What I want is to have a formula in column C, that returns the name of the first available person (not on holiday in that day), in exactly the same order as it is in the table's header.
Attached File : ON DUTY.xlsm‎
View 5 Replies
View Related
Apr 7, 2009
I'm currently using a lookup table to determine programs to run on a machine, however I have 3 exceptions to this and can not get my code to work.
Currently the code looks at column D for the type, then column F for the thickness of material. It then calculates the etch time required using the rate (all shown as 1 currently) on the cal_sheet and then rounds this up to a whole number. This is then compared to a second table where the program details are listed against etch times.
View 7 Replies
View Related
Jul 23, 2009
I have a macro that loops through a column of text and removes all text after a hyphen. Example: AU9929-PK becomes AU9929. I need to set up some exceptions that when it processes certain text it does not truncate it. Example: AU9929-ASST stays as AU9929-ASST. So far there are twelve exceptions but this could increase.
Note: The list which includes shop number, description, sku, sku description, quantity, unit price and more is sorted in a particular order as other operations are performed on it that requires it be in a specific order.
View 4 Replies
View Related
Dec 15, 2009
I have a workbook (Data) that I am entering "job title" into column G. Based on key words in the job title I am then manually entering "level" into Column V.
I have created a worksheet (Level Matrix) that has the following
Column A = Job title
Column B - Level
Column C = Exceptions
What I have in column A are the key words - as an example *Director* (wildcard Director Wildcard); in column B is the word Director
What I want the system to do is look for the word DIRECTOR anyplace in the job title entered into Column G of the data worksheet (hence why I have the title between wildcards. IF it finds it then I want to add the level automatically (from Column B of the Level Matrix worksheet).
However if the compare finds any of the words in the title that match any of the words in the Exceptions Column (Column C of the Level Matrix) then I DO NOT WANT To autoload the Director level- it would load DNA. As an example- an Art Director would not load "Director" becasue the word "art" is one of the words in the exceptions column of the Level Matrix.
View 9 Replies
View Related
Aug 22, 2007
I need to create a custom sort which will cause entries "TBD" and blank to appear at the bottom of my spreadsheet. Any other value will be sorted alphabetically. I'm not sure how to create my sort list to do this. I tried "*, TBD " but this did not work.
View 2 Replies
View Related
Feb 12, 2014
I have a workbook with timesheet records for a list of resources from multiple locations. These resources have logged time against the projects which is captured on a monthly basis. These time records are against holidays declared by the company. I would like to see if there are any of them who have logged time incorrectly on a holiday.?
View 4 Replies
View Related
Aug 11, 2009
When using conditional formatting, I have it set to the following:
C2=60 (Reference Cell)
C3=5 (Reference Cell)
Conditional Format Settings
If C3 >= C2/12 then pattern set to Green
If C3 < C2/12 then pattern set to Red
Here is the problem - when you have a value in C3, everything is fine, it's either green or red. If C3 is blank, it defaults to green because the conditional format is true.
Is there anyway to add something in there to have no color when C3 is not populated?
View 11 Replies
View Related
Oct 2, 2008
List File Name with multiple exceptions. I have this
View 2 Replies
View Related
Dec 26, 2008
I am having a problem combining two databases. I have database E and F. I need to take any price that is $0.00 from Database E and replace it with the data from database F. The catch is that there isn’t always a price to replace it with. Also, there are parts in database E that do not appear at all in database F. Below is an example (there are about 20,000 lines of data total)
In the examples above I have placed both databases together. Column four has the database designation. As you can see the 1748 Hose reducer has a price for F but none for E.
Basically I need some formula like the following:
If (part number xxx) and (part number XXX) from column 1 are the same, replace the price data from E with the price data from F but only if E = $0.00
Is this possible?
View 9 Replies
View Related
Oct 11, 2006
Basically I have the code to Delete All named ranges in active workbook, but I need it to skip over two named ranges called Categories and Length. Is there a way to adjust this to delete all named ranges in active workbook except a named range Categories and another called Length
Dim rName As Name
For Each rName In ActiveWorkbook.Names
rName.Delete
Next rName
View 2 Replies
View Related
Jul 1, 2014
I have 3 pivot tables and with 3 filters each (they are all the same filters). I just want to change 1 of the filters for each of the pivot table (meaning the other 2 stay the same for all of the pivots). Is it possible to have a filter change automatically to match a filter in another pivot?
View 9 Replies
View Related
Aug 14, 2007
I am calculating blood sugars for my daughter and putting them in a spreadsheet. The formula is simple:
Blood sugar - target blood sugar / 20 which yields the amount of insulin that she needs to take. I want this cell to be blank unless I enter a value in the cell above it.
Next, I take the value from that formula and add it to the amount of insulin that she takes for eating.
The value in the top formula can be 0 or less, but, if the value in the bottom one is less than 0, I want the cell to be blank.
View 9 Replies
View Related
Oct 26, 2007
I'm having problem with the ISBLANK function. I have attached my workbooks if someone would care to look at them. My macro basically loads two lists from other workbooks (old & new (attached)). It then finds out which entries are unique to each list, and places them in the EXCEPTIONS sheet.
Column C in these sheets should say TRUE or FALSE as to whether the corresponding cells in Column B are blank but it does not work. Book1.xls contains my macro.
Old.xls and New.xls will need to be selected when prompted.
View 3 Replies
View Related
Jul 18, 2014
is it possible to use two filters within a the same field.
ie. right now i can filter using the top 10 based on a value field.
what if i want to see the top 10 customers profit and along any drop in revenue from previous years..
something like this.
the information below was copied out of a pivot table that included the % difference.
Code and Name
YearCheck
Profit
Difference
[Code].....
View 1 Replies
View Related
Jul 10, 2007
I have a worksheet that is unprotected but I am unable to apply filters to it. The option is greyed out if I try and select autofilters.
Another strange thing is that on one of the worksheets when I select Data, Filters there is a tick to the left of Autofilter but it is also greyed out, so in effect I cannot turn it off even tho I can't see the filters!
I have tried to popst a screen shot but unsure how to do it. I think maybe a screen shot would help to explain my issue better so if anyone knows how to do this......
View 9 Replies
View Related
Jan 2, 2008
Let's say that A1:C5 looks like this:
Square Red $5
A2 is empty Blue $6
A3 is empty Orange $2
Circle Puple $10
A5 is empty Black $18
A2 and A3 could say "Square" and A5 could say "Circle" ... this is just how I have it set up right now.
In C1 I have a drop down list ... a list of "Square" and "Cirlce".
***QUESTION***
Is there a way for a user to select "square" from the drop down list and in D1 have excel populate a list of all the Squares colors and prices?
Example of what excel would populate in D1:E3:
Red $5
Blue $6
Orange $2
The thing is that I don't think filters is the answer. The reason being is that I want the user to be able to select the item from the list and have excel automatically populate the information. The user should not have to filter the list manually.
View 9 Replies
View Related
Aug 11, 2008
In my Sheet I have AutoFilter on multiple columns.
I want to view all rows where in different colomns there are values.
For example
Colomn D, Row 6 has a value
Colomn E, Row 6 has no value, But Colomn E, Row 7 has a value.
I want to view then Row 6 and 7, by setting an OR filter 9 or something like that .
by setting filter on Colomn D with ( not empty Cell ) and Filter on Colomn E with (not empty Cell ) it is only a AND function.
How can I get an OR function. ( Colomn D OR Colomn E )?
View 9 Replies
View Related
Feb 20, 2009
I'm trying to modify this code in order to do the following.
I want to choose first column and then the criteria for filter, then i want to choose a second column and criteria to filter the remain values from the first filter.
Here is my
Sub Filter()
Dim Myrange As Range
Dim CriteriaVal As Variant
Dim CriteriaVal2 As Variant
Dim KillColumn As Integer
Dim KillColumn2 As Integer
Dim ActiveColumn As String
Dim AC
Dim LastRow As Long
Dim rng As Range
View 9 Replies
View Related
Jul 26, 2006
I have several pagefields. Once something particular has been selected in one of them, I would like the remaining options in the other pagefields to be updated or refreshed showing only those where there is a correlation with the selected pagefield. In other words, exactly how your typical Excel filter works.
I assume there is no option to change the way pagefields interact to be like filters. How could this be done in VBA?
View 7 Replies
View Related
Dec 16, 2008
First post so please excuse me if this has been covered before but I am trying to get the results of a dropdown menu in one worksheet to become the criteria for a filter in another worksheet (both in teh same workbook).
I thought I could just add a reference to the dropdown cell into the autofilter (in VBA editor) but it doe't seem to be that simple.
Any ideas?
View 10 Replies
View Related
Dec 12, 2008
Subtotal doesn't add cells hidden under a filter column but it does when grouping. How can I get groups to change a subtotal based on whether they are hidden or not. What I'm really trying to do is use conditional formatting to change the format when a group is expanded vs collapsed.
View 3 Replies
View Related