ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   De-Dupe Records Based on Two Fields. (https://www.excelbanter.com/excel-discussion-misc-queries/99671-de-dupe-records-based-two-fields.html)

onlythebest

De-Dupe Records Based on Two Fields.
 

I've got 5 coumns, of data : Company, Address, C_S_Z, Phone, Fax : and
about 600 rows of companies.

Since some Comapnies share the same name I need a Macro that can
de-dupe based on two fields.. preferably Company and Address.

The Current de-dupe macro i use works. but only for one field :(

Any help would be amazing!!!!..


--
onlythebest
------------------------------------------------------------------------
onlythebest's Profile: http://www.excelforum.com/member.php...o&userid=36301
View this thread: http://www.excelforum.com/showthread...hreadid=562132


Bill

De-Dupe Records Based on Two Fields.
 
"onlythebest" wrote
in message ...

I've got 5 coumns, of data : Company, Address, C_S_Z, Phone, Fax : and
about 600 rows of companies.

Since some Comapnies share the same name I need a Macro that can
de-dupe based on two fields.. preferably Company and Address.

The Current de-dupe macro i use works. but only for one field :(

Any help would be amazing!!!!..


Try joining the respective strings together with "&". Your current macro
probably does some kind of comparison of one string against another.
Instead of comparing one string to another, compare two strings joined with
"&" (which makes one string). Tough to describe without your code.

Let's say Company Name is in column A and Address is in column B. Maybe
your code reads:

If A2 = A1 Then
Range("A2").EntireRow.Delete
End If

Try this:

If A2&B2 = A1&B1 Then
Range("A2").EntireRow.Delete
End If

Curious if that does it for you...

- Bill



onlythebest

De-Dupe Records Based on Two Fields.
 

:( ............


--
onlythebest
------------------------------------------------------------------------
onlythebest's Profile: http://www.excelforum.com/member.php...o&userid=36301
View this thread: http://www.excelforum.com/showthread...hreadid=562132



All times are GMT +1. The time now is 11:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com