Friday, October 26, 2012

Excel: Removing duplicates but keeping blank spaces

So you have finally gotten the 65,000 row spreadsheet from your boss that absolutely positively MUST be done before next weeks big meeting--but it has duplicate numbers in one column. You need every row--but you only want one of those column values to show for that row. What to do?

Example given data

John Project Manager
John Director of Human Resources
John Technology Supervisor

Desired data

John Project Manager
        Director of Human Resources
        Technology Supervisor

You could either manually erase all the extra column values and replace them with blank spaces--OR you could get create with Excel and run a formula to sift out all the extraneous data.

Copy your column data into another worksheet and put it into column A. In column B, write this formula:

=IF(COUNTIF(A$1:A1,A1)>1,"",A1)

You will see the first value in column B populate. Stretch this column all the way down and paste the contents into Wordpad or Notepad. Why not paste it back into your original Excel worksheet, you ask? Well--Microsoft Excel has this nasty habit of wanting to reference an equation instead of showing the equation results when you copy it into Excel. The work a round is to copy the data elsewhere first--then copy the data from Notepad or Wordpad BACK into your original excel, replacing your duplicated column.

It takes some practice--but is far better than the alternative manual erase method.