Search code examples
excelduplicatesexcel-2007deduplication

Delete duplicates from two columns using the first one as a criterion


I have a problem with Excel 2007 and I really don't know what to do. I have a file with about 200k+ data in two columns. In column A (time) some values duplicate, and so in column B (amp). I would like to delete duplicates from two columns at once, using values in column A as criteria. Here is how it looks:

   time   amp
    1      27
    14     27
    129    40
    129    41
    129    42
    130    43
    130    42

and I would like it to be like:

time   amp
1      27
14     27
129    40
130    43

The "Remove Duplicates" command in Excel is fine but only for one column. In my case it doesn't do the job because "Remove Duplicates" works only if there are the same values in TWO columns, e.g.

1   27
1   27

I would prefer to avoid macros because I don't know anything about VBA and I can't use it, but if there is no other option (I suppose there isn't...) macro would be fine.

I don't even know how to ask Google for the solution because I don't know how to describe the problem in a few words.


Solution

  • I suspect you are not applying Remove Duplicates correctly. Select both Columns but uncheck amp in the popup. Otherwise, since it seems you are picking the first instance of amp for any duplicated time, you could extract a list of unique values for time such as with Advanced Filter, Copy to another location, choose where, check Unique records only, and then use that selection as the key to look up in your source data with either VLOOKUP or an INDEX/MATCH combination. For duplicates both these ways stop looking once they have found a match, so only the first instance is returned.