You are here:

Excel/Remove duplicate values in Excel

Advertisement


Question
Hi Tom,

I have an excel question, and hope you could help with.

There are several columns and rows in a spreadsheet. Some columns have the same values, other columns have different values. For example:

   Column A Column B Column C Column D Column E Column F
Row1   A        B        C       123      E         F
Row2   A        B        C       234      E         F
Row3   A        B        C       345      E         F
Row4   A        B        C       456      E         F
Row5   A        B        C       567      E         F
Row6   A        B        C       678      E         F

If the values are the same in one column, I want them to show only once. For example:
   Column A Column B Column C Column D Column E Column F
Row1   A        B        C       123       E        F
Row2          234      
Row3          345      
Row4          456      
Row5          567      
Row6          678

Is there a way that VBA can remove the duplicate values in a column?

Thanks in advance for your help.

Eric

Answer
Eric,

certainly a macro can be written to remove duplicates.  However, in Excel 2007 and later, Microsoft added a menu item to remove duplicates.  It is found under the data tab. I would explore using the built in capabilities of Excel to remove duplicates before trying to write a macro.  I assume you are not familiar with this built in capability available since Excel 2007.

--
Regards,
Tom Ogilvy

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Tom Ogilvy

Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 About.com. All rights reserved.