Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Delete duplicate Date - both the duplicate and the copy of it

Posted on 2011-03-09
7
216 Views
Last Modified: 2012-08-13
Hello,

I know Excel 07 has a function to delete duplciate data and you can be left with the unique values.  But I need something that deletes both the duplicate and the other copy of it.  

thank you.
0
Comment
Question by:pdvsa
  • 4
  • 3
7 Comments
 

Author Comment

by:pdvsa
ID: 35087532
so for example

1
1
2
2
3

would leave an answer of 3
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35087685
Here's one method of doing this:

- Add a 2nd column with this formula:

 =COUNTIF(A:A,A1) copied down

- Use Paste Special/Values to convert formula results to values

- Sort this new column and then delete all rows that have the value >1

jppinto

0
 
LVL 33

Accepted Solution

by:
jppinto earned 500 total points
ID: 35087735
You can make it using a macro like the attached example.

jppinto
RemoveDuplicates.xlsm
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:pdvsa
ID: 35087853
cool.  Does that handle the entire column in A?  I see C there so not sure how it is working. but it does work...
Sub RemoveDups()
    Columns("C:C").Insert
    Bottom = [A1].End(xlDown).Row
    Range("C2:C" & Bottom).Select
    Selection = "=1/(COUNTIF(R2C1:R" & Bottom & "C2,RC[-2])-1)"
    Selection.SpecialCells(xlCellTypeFormulas, 1).EntireRow.Delete
    Columns("C:C").Delete
End Sub
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35087908
The code check for the last value on column A (where the values are):

Bottom = [A1].End(xlDown).Row

Then it insert a new column on C to put the formula on that column:

Selection = "=1/(COUNTIF(R2C1:R" & Bottom & "C2,RC[-2])-1)"

Then it will select all the cells on column C that have the value "1" and deletes the rows.

jppinto
0
 

Author Comment

by:pdvsa
ID: 35087921
OH I see... very interesting thahkyou
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35087931
Thanks for the grade...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question