Solved

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

Posted on 2011-03-09
7
217 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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