Identify rows that have cells that match criteria in other rows

bgill

New Member
Joined
Aug 22, 2002
Messages
33
Good morning! I am using Excel 2010 and have a set of data with over 200000 rows. I need to find all of the rows that have an 18 in the first column where the ID and the # are the same as any row with the same absolute value as the value in the row with 18 in the code. If the person listed has any rows that meet the above criteria I will need to keep all of the rows for that person. If they don't, I can delete all of the rows for that person. For example, I want to keep all of the rows for John but can delete both rows for Nancy. I am fine with a formula that will identify the ones I can keep or delete and then using a filter. Any ideas?



Excel 2010
ABCDEFGH
1CODEIDQtr#BYE DateFULL NAMECharges/Creditsabsolute vlaue
21834154820142123420140302John(5,004.00)5004.00
334154820142123420140302John(5,004.00)5004.00
434154820134123420140302John5,004.005004.00
518157302420134234520130714Nancy550.00550.00
6157302420134234520130714Nancy1,650.001650.00
72265844201423445620130818Sandra0.040.04
8182265844201423445620130818Sandra75.1575.15
9182659714201423445620130818Sandra42.5342.53
109950055201423445620130818Sandra(0.01)0.01
11294238720134567820140126Susan258.00258.00
1218294238720142567820140126Susan(4,902.00)4902.00
13294238720141567820140126Susan(4,902.00)4902.00
14294238720142567820140126Susan(4,902.00)4902.00
15294238720142567820140126Susan4,902.004902.00
1618233950020141789020140602Melanie64.0064.00
17233950020141789020140602Melanie122.00122.00
1818282782420142987620140330Ray56.0056.00
19282782420142987620140330Ray(56.00)56.00
201861226120134876520101101Dee(1,257.60)1257.60
2161226120134876520101101Dee(1,257.60)1257.60
2218217261120134876520101101Dee(694.40)694.40
23217261120134876520101101Dee(694.40)694.40
24305444120134765420130630Kelley(20.00)20.00
2518305444120141765420130630Kelley(25.00)25.00
26305444120141765420130630Kelley(25.00)25.00
2718130901920134765420140601Alana3.273.27
28130901920134765420140601Alana8.198.19
Sheet1
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try this formula in I2 copied down:

=COUNTIFS(B:B,B2,D:D,D2,H:H,H2)>1

You can then AutoFilter column I for FALSE and delete the visible rows.
 
Upvote 0
Thank you Andrew. That is really close to what I need. The only problem is that I need to keep all of the rows for the same person if any of the rows for that person have the matching criteria. For example, I need to keep all of the rows for Susan, 11 - 15, even though row 11 does not have a matching value.
 
Upvote 0
How about?

=COUNTIFS(B$2:B$28,B2,D$2:D$28,D2,H$2:H$28,INDEX(H$2:H$28,MATCH(1,INDEX((A$2:A$28=18)*(B$2:B$28=B2)*(D$2:D$28=D2),),FALSE)))>1
 
Upvote 0
Brilliant! Thank you very much Andrew. You have just saved me hours and hours and hours of reading 200000 rows of data!

Happy Holidays to you!
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

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