I am using the advanced filter to sort our unique records in a multi thousand row spreadsheet. Is there any way to filter out the unique records and have the filter ignore one of the columns? I don’t want the “uniqueness” to be determined by the date field, but I need to keep the data from that field associated with the other columns. I have tried filtering on the list and using the other columns as the criteria info, but it is not sorting out the duplicates.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Advanced Filtering Unique Records (XP)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Advanced Filtering Unique Records (XP)
- This topic has 24 replies, 3 voices, and was last updated 21 years, 1 month ago.
Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody Lounger -
WSklott54
AskWoody Lounger -
WSsdckapr
AskWoody LoungerFebruary 19, 2004 at 2:30 pm #787187To reask Hans’ question (since you didn’t answer it) with an example. In the table below the 3 non-date columns are identical They are only different in date. All 3 rows are unique. If you ignore the date they are all the same. If you want to find the unique items (ignoring the date) this list gives only 1.
Date Name Letter Number 01/01/2004 Bill A 1 01/02/2004 Bill A 1 01/03/2004 Bill A 1 Which date should be associated with this 1 item?
Steve
-
WSklott54
AskWoody LoungerFebruary 19, 2004 at 2:36 pm #787189Steve: I had answered, sorry you did not get. I have been using the most recent date, however, that is not as important as isolating the one record. These are trouble tickets, and they may be re-reported on different days, so multiple instances may occur. I only need one instance per unique record of the name/letter/number combination.
-
WSklott54
AskWoody LoungerFebruary 19, 2004 at 2:36 pm #787190Steve: I had answered, sorry you did not get. I have been using the most recent date, however, that is not as important as isolating the one record. These are trouble tickets, and they may be re-reported on different days, so multiple instances may occur. I only need one instance per unique record of the name/letter/number combination.
-
-
WSsdckapr
AskWoody LoungerFebruary 19, 2004 at 2:30 pm #787188To reask Hans’ question (since you didn’t answer it) with an example. In the table below the 3 non-date columns are identical They are only different in date. All 3 rows are unique. If you ignore the date they are all the same. If you want to find the unique items (ignoring the date) this list gives only 1.
Date Name Letter Number 01/01/2004 Bill A 1 01/02/2004 Bill A 1 01/03/2004 Bill A 1 Which date should be associated with this 1 item?
Steve
-
WSHansV
AskWoody LoungerFebruary 19, 2004 at 2:39 pm #787191Here is a small example table:
Col1 Col2 Col3 Col4 north widget red 02/11/04 north widget red 02/18/04 north widget blue 02/18/04 If we ignore Col4 when deciding which rows are unique, we end up with this:
Col1 Col2 Col3 Col4 north widget red ??? north widget blue 02/18/04 What should be in the place of the question marks?
-
WSklott54
AskWoody Lounger -
WSsdckapr
AskWoody LoungerFebruary 19, 2004 at 3:15 pm #787205The easiest way would be to use the advanced filter (without extracting the date) then in the date column use a formula to grab the most recent date for that unique occurence. It would have to be an Array or a user function. which ever is not as sluggish. Something like this ARRAY
=min(if((Col1=Value1)*(Col2=Value2)*(Col3=Value3)*…*(Coln=Valuen),DateCol))
Where Cols are the range of each col and Values are the values to compare.
If it were too slow, you could just have a macro grab the unique entries (ignoring the date) and and then lookup the most recent date for it. Then you would call the macro rather than the adv filter routine.
We would need a lot more info to write formulas or code anything.
Steve
-
WSsdckapr
AskWoody LoungerFebruary 19, 2004 at 3:15 pm #787206The easiest way would be to use the advanced filter (without extracting the date) then in the date column use a formula to grab the most recent date for that unique occurence. It would have to be an Array or a user function. which ever is not as sluggish. Something like this ARRAY
=min(if((Col1=Value1)*(Col2=Value2)*(Col3=Value3)*…*(Coln=Valuen),DateCol))
Where Cols are the range of each col and Values are the values to compare.
If it were too slow, you could just have a macro grab the unique entries (ignoring the date) and and then lookup the most recent date for it. Then you would call the macro rather than the adv filter routine.
We would need a lot more info to write formulas or code anything.
Steve
-
WSsdckapr
AskWoody LoungerFebruary 19, 2004 at 3:40 pm #787223Another idea is to use an autofilter, though it will require 2 additional columns. This method assumes that the lowest rows have the lowest dates. It picks the dates from the lowest rows of the “multiple unique” entries.
The first column (could be hidden) would be a concatenation of all the columns that you want to be considered in the unique. I will assume it is in Col G and the data starts in row 2 (header in row 1) so G2 would be something like:
=B2&C2&D2&E2&F2
to find the unique entries in B-F (A has the date, it is not included)Then in H2:
=countif($G$2:G2,G2)=1Copy G2:H2 down all the rows with data
Add the autofilter: data – filter – autofilter. Then select col H dropdown and select TRUE. You will get the unique list of all the items in cols B-F with all other cols the values from the lowest rows. If you need to be lowest date it will have to be sorted by date first.
Steve
-
WSklott54
AskWoody LoungerFebruary 19, 2004 at 6:31 pm #787341See the attachment. Rows 1 and 2 would not be unique even though the dates are different. Rows 3 and 4 would be unique. Right now, the advanced filtering gets me to this stage, but I have still having to go through 20K rows to see if there are any duplicates. I would like to filter out any rows that the only uniqueness is the date.
-
WSHansV
AskWoody LoungerFebruary 19, 2004 at 7:02 pm #787361The attached zipped workbook uses a macro and a function to sort the data and remove duplicates, keeping the most recent date. To see the effect, press Alt+F8 in the workbook, select FilterUnique and click Run. You should not have macro security set to high, for that disables macros completely. (I recommend setting it to medium.)
-
WSklott54
AskWoody Lounger -
WSHansV
AskWoody LoungerFebruary 19, 2004 at 7:29 pm #787385You could in fact run the macro without copying it, but here is how to copy it.
Before you do so, make a backup copy of your workbook, so that you can fall back on that if something goes wrong!
Open both the workbook I posted and your own workbook.
Activate the Visual Basic Editor by typing Alt+F11.
Make sure that the Project Explorer is visible (Ctrl+R). This looks like the left hand pane of Windows Explorer, but with Excel objects instead of drives and folders.
If necessary, expand until you see VBAProject (FilterUnique.xls) | Modules | Module1.
Drag Module1 to your own workbook and drop it. This will copy the module with the macro in it to your workbook.If you want to see the VBA code, double click Module1. You will see one macro (Sub FilterUnique) and one auxiliary function (Function CompareRows)
If necessary, you can modify little bits of the code. -
WSHansV
AskWoody LoungerFebruary 19, 2004 at 7:29 pm #787386You could in fact run the macro without copying it, but here is how to copy it.
Before you do so, make a backup copy of your workbook, so that you can fall back on that if something goes wrong!
Open both the workbook I posted and your own workbook.
Activate the Visual Basic Editor by typing Alt+F11.
Make sure that the Project Explorer is visible (Ctrl+R). This looks like the left hand pane of Windows Explorer, but with Excel objects instead of drives and folders.
If necessary, expand until you see VBAProject (FilterUnique.xls) | Modules | Module1.
Drag Module1 to your own workbook and drop it. This will copy the module with the macro in it to your workbook.If you want to see the VBA code, double click Module1. You will see one macro (Sub FilterUnique) and one auxiliary function (Function CompareRows)
If necessary, you can modify little bits of the code. -
WSklott54
AskWoody Lounger -
WSHansV
AskWoody LoungerFebruary 19, 2004 at 7:02 pm #787362The attached zipped workbook uses a macro and a function to sort the data and remove duplicates, keeping the most recent date. To see the effect, press Alt+F8 in the workbook, select FilterUnique and click Run. You should not have macro security set to high, for that disables macros completely. (I recommend setting it to medium.)
-
WSklott54
AskWoody LoungerFebruary 19, 2004 at 6:31 pm #787342See the attachment. Rows 1 and 2 would not be unique even though the dates are different. Rows 3 and 4 would be unique. Right now, the advanced filtering gets me to this stage, but I have still having to go through 20K rows to see if there are any duplicates. I would like to filter out any rows that the only uniqueness is the date.
-
WSsdckapr
AskWoody LoungerFebruary 19, 2004 at 3:40 pm #787224Another idea is to use an autofilter, though it will require 2 additional columns. This method assumes that the lowest rows have the lowest dates. It picks the dates from the lowest rows of the “multiple unique” entries.
The first column (could be hidden) would be a concatenation of all the columns that you want to be considered in the unique. I will assume it is in Col G and the data starts in row 2 (header in row 1) so G2 would be something like:
=B2&C2&D2&E2&F2
to find the unique entries in B-F (A has the date, it is not included)Then in H2:
=countif($G$2:G2,G2)=1Copy G2:H2 down all the rows with data
Add the autofilter: data – filter – autofilter. Then select col H dropdown and select TRUE. You will get the unique list of all the items in cols B-F with all other cols the values from the lowest rows. If you need to be lowest date it will have to be sorted by date first.
Steve
-
-
WSklott54
AskWoody Lounger
-
-
WSHansV
AskWoody LoungerFebruary 19, 2004 at 2:39 pm #787192Here is a small example table:
Col1 Col2 Col3 Col4 north widget red 02/11/04 north widget red 02/18/04 north widget blue 02/18/04 If we ignore Col4 when deciding which rows are unique, we end up with this:
Col1 Col2 Col3 Col4 north widget red ??? north widget blue 02/18/04 What should be in the place of the question marks?
-
-
WSklott54
AskWoody Lounger
-
-
WSHansV
AskWoody Lounger
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Firefox 137
by
Charlie
35 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
2 hours, 35 minutes ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
2 hours, 47 minutes ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
2 hours, 50 minutes ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
2 hours, 55 minutes ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
6 hours, 21 minutes ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
12 hours, 23 minutes ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
22 hours, 43 minutes ago -
Office apps read-only for family members
by
b
1 day, 1 hour ago -
Defunct domain for Microsoft account
by
CWBillow
22 hours, 11 minutes ago -
24H2??
by
CWBillow
12 hours, 22 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
6 hours, 37 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
6 hours, 50 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
3 hours, 12 minutes ago -
two pages side by side land scape
by
marc
2 days, 23 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
3 days, 1 hour ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
2 days, 4 hours ago -
Security Essentials or Defender?
by
MalcolmP
2 days, 6 hours ago -
April 2025 updates out
by
Susan Bradley
1 hour, 52 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
2 days ago -
WARNING about Nvidia driver version 572.83 and 4000/5000 series cards
by
Bob99
1 day, 14 hours ago -
Creating an Index in Word 365
by
CWBillow
2 days, 16 hours ago -
Coming at Word 365 and Table of Contents
by
CWBillow
1 day, 4 hours ago -
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
3 days, 20 hours ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
3 days, 23 hours ago -
W11 24H2 – Susan Bradley
by
G Pickerell
4 days, 1 hour ago -
7 tips to get the most out of Windows 11
by
Alex5723
3 days, 23 hours ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
1 hour, 15 minutes ago -
I installed Windows 11 24H2
by
Will Fastie
1 day, 23 hours ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
4 days, 4 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.