SOLVED
Home

Removing duplicates

%3CLINGO-SUB%20id%3D%22lingo-sub-737636%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-737636%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369954%22%20target%3D%22_blank%22%3E%40MMcDonal%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20This%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E*%20Select%20the%20range%20you%20want%20to%20remove%20the%20duplicates%20from%2C%20Go%20into%20the%20Data%20Tab%2C%20under%20the%20data%20tools%20group%20click%26nbsp%3B%3CSTRONG%3ERemove%20Duplicates%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E*%20Check%20the%20two%20column%20you%20want%20to%20remove%20the%20Duplicates%20from%20and%20click%20OK%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20434px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122165iE630B72E469EA3B5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%221.PNG%22%20title%3D%221.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-742719%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-742719%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F367553%22%20target%3D%22_blank%22%3E%40Excel_World_Champion%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20EWC.%26nbsp%3B%20I%20believe%20your%20method%20would%20remove%20all%20duplicate%20values%20irrespective%20of%20the%20duplicate%20values%20based%20on%20different%20sources.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESee%20screenshot%20below%20of%20a%20larger%20spreadsheet%20where%20there%20are%20duplicate%20values.%26nbsp%3B%20My%20goal%20is%20to%20remove%20only%20duplicate%20values%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eby%20source%20only%3C%2FSPAN%3E.%26nbsp%3B%20So%20in%20this%20case%2C%20removal%20of%26nbsp%3B%3CSPAN%3Eall%26nbsp%3B%3C%2FSPAN%3Eduplicate%20values%20by%20source%20(name)%2C%20including%20the%20%243%2C000%20duplicate%20value%20for%20GenD%2C%3CSPAN%3E%26nbsp%3Bbut%20no%3C%2FSPAN%3E%3CSPAN%3Et%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20Henry%20S.%20and%20HewP%20since%20they%20are%20separate%20sources%2Fnames.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%243%2C000%20values%20for%20GenD%20and%20HenryS%20should%20remain%20intact%2Fnot%20removed%2C%20since%20they%20are%20separate%20sources%20of%20the%20duplicate%20values%20within%20the%20range%20(spreadsheet).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20322px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122559iF4B33C4E906050C6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Removal%20of%20Duplicate%20Values%20per%20Each%20Source.png%22%20title%3D%22Removal%20of%20Duplicate%20Values%20per%20Each%20Source.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMMcDonal%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-743322%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-743322%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369954%22%20target%3D%22_blank%22%3E%40MMcDonal%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20remove%20by%20source%20select%20all%20columns%20in%20your%20range%20and%20check%20only%20one%20with%20source%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20373px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122602iBCD53E8EB0159E19%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EResult%20is%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20222px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122603i41ACF6B5B162F318%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-747376%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-747376%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20Sergei%2C%20particularly%20since%20it%20is%20a%20function%20I%20will%20need%20to%20use%20repeatedly%20on%20numerous%20similar%20projects%20going%20forward.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-748902%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-748902%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369954%22%20target%3D%22_blank%22%3E%40MMcDonal%3C%2FA%3E%26nbsp%3B%2C%20Power%20Query%20could%20be%20a%20variant%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-734474%22%20slang%3D%22en-US%22%3ERemoving%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-734474%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20I%20remove%20duplicate%20values%20associated%20with%20a%20name%20only%3F%26nbsp%3B%20I%20have%20a%20number%20of%20the%20duplicate%20values%20that%20are%20repeated%20across%20a%20table%20range%20and%20correspond%20to%20different%20names%20(in%20the%20column%20to%20the%20right%20of%20the%20values.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20only%20want%20to%20delete%20duplicate%20values%20associated%20with%20each%20corresponding%20name%20only%2C%20and%20not%20all%20duplicate%20values%20in%20the%20table%20range.%26nbsp%3B%20Thanks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-734474%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENeed%20Help%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-912762%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-912762%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Sergei.%26nbsp%3B%20Coming%20back%20to%20you%20after%204%20months.%20Hope%20all's%20well%20with%20you.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20were%20most%20helpful%20to%20me%20in%20July.%26nbsp%3B%20Was%20hoping%20you%20could%20you%20help%20me%20out%20with%20the%20following%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20large%20spreadsheet%20with%20multiple%20duplicate%20values%20from%20the%20same%20client%20source.%20However%2C%20there%20are%20different%20policies%20assigned%20to%20the%20client%20source%20that%20I%20do%20not%20wish%20to%20remove%20when%20applying%20the%26nbsp%3B%20%22remove%20duplicates%22%20function.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20attached%20sample%20shows%20duplicate%20values%20for%20different%20policies%20for%20the%20same%20client%20name.%20The%20source%20of%20the%20duplicate%20values%20(losses)%20is%20the%20client%20name%20and%20one%20or%20several%20of%20the%20policy%20(numbers)%20for%20that%20client%20name.%20For%20my%20needs%2C%20it%20does%20not%20matter%20which%20of%20the%20policies%20make%20up%20the%20duplicate%20value.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20retain%20all%20policies%20relating%20to%20the%20same%20client%20source%20but%20reflect%20the%20duplicate%20value%20only%20once%2C%20as%20shown%20in%20the%20attached%20sample.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-914222%22%20slang%3D%22en-US%22%3ERe%3A%20Removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-914222%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369954%22%20target%3D%22_blank%22%3E%40MMcDonal%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20your%20latest%20sample%20it's%20not%20removing%20of%20duplicates%20for%20which%20you%20remove%20entire%20rows%20based%20on%20some%20criteria.%20Here%20you'd%20like%20to%20empty%20repeating%20values%20in%20first%20and%20second%20columns%20keeping%20the%20rest%20untouched.%3C%2FP%3E%0A%3CP%3EBetter%20to%20do%20that%20with%20formulas%20in%20these%20first%20columns.%20Logic%20of%20formula%20depends%20on%20logic%20of%20the%20data%20structuring%20-%20will%20it%20be%20sorted%2Ffiltered%20or%20not%3B%20is%20it%20necessary%20to%20treat%20differently%20zero%20values%20and%20empty%20cells%3B%20shall%20we%20empty%20these%20values%20only%20for%20sequentially%20repeating%20values%20in%204th%20column%20or%20that%20doesn't%20matter.%20For%20example%2C%20in%20your%20sample%20you%20empty%20values%20for%26nbsp%3BGGG%20Demolition%2C%20Inc.%20but%20not%20for%26nbsp%3BBairos%20Recycling%20Inc%2C%20which%20also%20is%20repeating%20with%20non-zero%20values%2C%20but%20not%20one%20by%20one.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20example%2C%20in%20A3%20it%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF(%20(D3%3DD2)*(A2%26gt%3B0)%2C%22%22%2C%20SUMPRODUCT(('N%3A%5CAudit%20Database%5C2019%20Audits%5CLos%20Angeles%5CNovember%202019%5CEnvironmental%5CLosses%5C%5BEnvironmental%20Loss%20Run%2010.14.19.xlsx%5DSheet1'!%24A%3A%24B%3DD3)*1))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%2C%20similar%20in%20B3%20and%20we%20may%20drag%20them%20down.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPerhaps%20above%20formulas%20shall%20be%20more%20complex%2C%20but%20again%2C%20it%20depends%20logic%20of%20data%20itself.%3C%2FP%3E%3C%2FLINGO-BODY%3E
MMcDonal
Occasional Contributor

 

How do I remove duplicate values associated with a name only?  I have a number of the duplicate values that are repeated across a table range and correspond to different names (in the column to the right of the values.)

 

I only want to delete duplicate values associated with each corresponding name only, and not all duplicate values in the table range.  Thanks.

 

11 Replies

Hey @MMcDonal 

 

Try This:

 

* Select the range you want to remove the duplicates from, Go into the Data Tab, under the data tools group click Remove Duplicates:

* Check the two column you want to remove the Duplicates from and click OK

 

1.PNG

 

 

@Excel_World_Champion 

 

Thanks EWC.  I believe your method would remove all duplicate values irrespective of the duplicate values based on different sources.

 

See screenshot below of a larger spreadsheet where there are duplicate values.  My goal is to remove only duplicate values by source only.  So in this case, removal of all duplicate values by source (name), including the $3,000 duplicate value for GenD, but not for Henry S. and HewP since they are separate sources/names. 

 

The $3,000 values for GenD and HenryS should remain intact/not removed, since they are separate sources of the duplicate values within the range (spreadsheet).

 

Removal of Duplicate Values per Each Source.png

 

Thanks!

 

MMcDonal

@MMcDonal 

To remove by source select all columns in your range and check only one with source

image.png

Result is

image.png

@Sergei Baklan 

 

Thank you Sergei, particularly since it is a function I will need to use repeatedly on numerous similar projects going forward.  

@MMcDonal , Power Query could be a variant

@Sergei Baklan

 

Hi Sergei.  Coming back to you after 4 months. Hope all's well with you. 

 

You were most helpful to me in July.  Was hoping you could you help me out with the following?

 

I have a large spreadsheet with multiple duplicate values from the same client source. However, there are different policies assigned to the client source that I do not wish to remove when applying the  "remove duplicates" function.

 

The attached sample shows duplicate values for different policies for the same client name. The source of the duplicate values (losses) is the client name and one or several of the policy (numbers) for that client name. For my needs, it does not matter which of the policies make up the duplicate value. 

 

I would like to retain all policies relating to the same client source but reflect the duplicate value only once, as shown in the attached sample. 

 

Thanks. 

 

 

@MMcDonal 

In your latest sample it's not removing of duplicates for which you remove entire rows based on some criteria. Here you'd like to empty repeating values in first and second columns keeping the rest untouched.

Better to do that with formulas in these first columns. Logic of formula depends on logic of the data structuring - will it be sorted/filtered or not; is it necessary to treat differently zero values and empty cells; shall we empty these values only for sequentially repeating values in 4th column or that doesn't matter. For example, in your sample you empty values for GGG Demolition, Inc. but not for Bairos Recycling Inc, which also is repeating with non-zero values, but not one by one.

 

For example, in A3 it could be

=IF( (D3=D2)*(A2>0),"", SUMPRODUCT(('N:\Audit Database\2019 Audits\Los Angeles\November 2019\Environmental\Losses\[Environmental Loss Run 10.14.19.xlsx]Sheet1'!$A:$B=D3)*1))

, similar in B3 and we may drag them down.

 

Perhaps above formulas shall be more complex, but again, it depends logic of data itself.

Thanks Sergei. I will take a look at your formula and see if it works for my purpose.
You raised some good questions: (a) The data does not have to be filtered/sorted; (b) there is no difference between cells with zero values and empty cells. (I removed the repeated (non-zero) values for GGG Demolition under to "To This" data set and left those cells blank/empty, and (c) I overlooked the second/lower $810 entry for Bairos Recycling, which I should have cleared/deleted under the "To This" data group, same as I did with GGG Demolition.
Again, thanks.
Solution

@MMcDonal 

Thank you for the clarification. With this I'd use the formula as

=IF( COUNTIF($D$2:$D2,$D3),0, SUMPRODUCT(('N:\Audit Database\2019 Audits\Los Angeles\November 2019\Environmental\Losses\[Environmental Loss Run 10.14.19.xlsx]Sheet1'!$A:$B=D3)*1))

and apply to column custom number format as

General;General;"-"??;@

to hide zeros. 

@Sergei Baklan 

 

This is [very] good.   Thanks Sergei for your time, effort, and expertise.

 

Michael

@MMcDonal 

Michael, you are welcome

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
description for autoplay blocking in settings page
HotCakeX in Discussions on
8 Replies