?
Solved

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

Posted on 2011-03-09
7
Medium Priority
?
222 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
[X]
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
  • 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 2000 total points
ID: 35087735
You can make it using a macro like the attached example.

jppinto
RemoveDuplicates.xlsm
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

650 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