How remove all rows but those with Duplicate info in one field

xcellerator

New Member
Joined
Feb 22, 2017
Messages
23
Office Version
  1. 2019
Platform
  1. MacOS
Hello -
I am trying to remove all rows *except* the rows that contain duplicate information in one specific field.
In the below example I am focused on leaving the full row of any entry for which the VIN number appears more than once in the file.
The data might be poorly entered (so someone might enter the wrong model or color of car), but the VIN number is always correct.
Is there a way to do this without VBA? (FYI on a Mac) That would be ideal. I am thinking I need to have a full helper column to filter off of, but am wondering if there is a more elegant way.

mrexcel-filter.xlsx
ABCDEF
1CustomerManufacturerModelVINSale DateColor
2BobFordEscape12345620200604Red
3RileyTeslaModel S11120190407Red
4AnnPontiacAztek100000020191112Yellow
5SamFordBronco12345620200104Red
6BillSubaruBrat11111120180602Black
7CarolChevyVega11119851010Red
8KatieRenaultLe Car22222220170308Black
9SallyFordEscape12345620160302Blue
10TomPontiacAztek45645619801103Silver
11OscarAMCPacer1010101019721022Silver
12
13
14Desired output: full row of any row where there are 2 or more sales with the same VIN
15
16CustomerManufacturerModelVINDateColor
17BobFordEscape12345620200604Red
18SamFordBronco12345620200104Red
19BobFordEscape12345620160302Blue
20RileyTeslaModel S11120190407Red
21CarolChevyVega11119851010Red
adv-filter-dupe-1
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You can filter out the False

Book1
ABCDEFG
1CustomerManufacturerModelVINSale DateColorCount Greater than 1
2BobFordEscape12345620200604RedTRUE
3RileyTeslaModel S11120190407RedTRUE
4AnnPontiacAztek100000020191112YellowFALSE
5SamFordBronco12345620200104RedTRUE
6BillSubaruBrat11111120180602BlackFALSE
7CarolChevyVega11119851010RedTRUE
8KatieRenaultLe Car22222220170308BlackFALSE
9SallyFordEscape12345620160302BlueTRUE
10TomPontiacAztek45645619801103SilverFALSE
11OscarAMCPacer1010101019721022SilverFALSE
Sheet1
Cell Formulas
RangeFormula
G2:G11G2=COUNTIF($D$2:$D$11,D2)>1
 
Upvote 0
How about
+Fluff v2.xlsm
ABCDEF
1CustomerManufacturerModelVINSale DateColor
2BobFordEscape12345620200604Red
3RileyTeslaModel S11120190407Red
4AnnPontiacAztek100000020191112Yellow
5SamFordBronco12345620200104Red
6BillSubaruBrat11111120180602Black
7CarolChevyVega11119851010Red
8KatieRenaultLe Car22222220170308Black
9SallyFordEscape12345620160302Blue
10TomPontiacAztek45645619801103Silver
11OscarAMCPacer1010101019721022Silver
12
13CustomerManufacturerModelVINSale DateColor
14BobFordEscape12345620200604Red
15SamFordBronco12345620200104Red
16SallyFordEscape12345620160302Blue
17RileyTeslaModel S11120190407Red
18CarolChevyVega11119851010Red
19
Data
Cell Formulas
RangeFormula
A14:F18A14=SORT(FILTER(A2:F11,COUNTIFS(D2:D11,D2:D11)>1),4,-1)
Dynamic array formulas.
 
Upvote 0
Thanks once again @Fluff , just what I was looking for, and never would have figured out.
The power of Advanced and then these Sort and Filter functions is so great...it always eludes me since the frequency I use these functions is rare that it never seems to stick (like learning a language...)
Will be interesting to see how it runs...over about 10k rows now, increasing to maybe 100k over time.
Much appreciated again-
 
Upvote 0
The countifs could slow things down a bit with that amount of data, this might be a tad quicker, but not sure
Excel Formula:
=SORT(FILTER(A2:F11,ISNA(XMATCH(D2:D11,UNIQUE(D2:D11,,1),0))),4,-1)
 
Upvote 0
Sorry to trouble you @Fluff - a related question
This function works find on one of my Mac (16.41, Office 365 Subscription), but not my other Mac (16.41, Retail License 2019) - one is a home machine and one is for work.
Unfortunately (of course!) I'm planning on doing the work on the Mac with the Retail License.
Would you happen to know why I would be getting the error:
Alert - That function isn't valid
and it highlights the 'SORT', so I believe it is referring to the SORT function (as opposed to the FILTER or COUNTIFS)
Thank you again-
 
Upvote 0
Neither sort nor filter are available with 2019. They only exist in 365.
 
Upvote 0
Ahh, that would explain my trouble. And...rats!! ?
Will look for another solution (maybe code is the only way and I'll have to go that route!.
Thank you again @Fluff
 
Upvote 0
You can try
+Fluff v2.xlsm
ABCDEF
1CustomerManufacturerModelVINSale DateColor
2BobFordEscape12345620200604Red
3RileyTeslaModel S11120190407Red
4AnnPontiacAztek100000020191112Yellow
5SamFordBronco12345620200104Red
6BillSubaruBrat11111120180602Black
7CarolChevyVega11119851010Red
8KatieRenaultLe Car22222220170308Black
9SallyFordEscape12345620160302Blue
10TomPontiacAztek45645619801103Silver
11OscarAMCPacer1010101019721022Silver
12
13CustomerManufacturerModelVINSale DateColor
14BobFordEscape12345620200604Red
15RileyTeslaModel S11120190407Red
16SamFordBronco12345620200104Red
17CarolChevyVega11119851010Red
18SallyFordEscape12345620160302Blue
19      
20      
21      
22
Data
Cell Formulas
RangeFormula
A14:F21A14=IFERROR(INDEX(A$2:A$11,AGGREGATE(15,6,(ROW($D$2:$D$11)-ROW($D$2)+1)/(COUNTIFS($D$2:$D$11,$D$2:$D$11)>1),ROWS(A$14:A14))),"")


It may need CSE entry & is likely to be a bit slow over 10,000+ rows
 
Upvote 0

Forum statistics

Threads
1,223,406
Messages
6,171,927
Members
452,434
Latest member
NUC_N_FUTS2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top