I have a list of names that includes duplicates (all in Column A of my worksheet). What I am trying to do is convert the duplicates into blank cells. I do need to keep the values in the rows where column A ends up with blanks. In the example below, I demonstrate what I currently have in my list and the second table demonstrates what I need the result to look like. The names Mike, Bill and Jim are the duplicates that are converted to blanks, but next to those blanks I still have the values I need (Xs in columns 1 and 2). The reason I want to get blanks is because I will filter those blanks out and remove them from a master table I am working.
I used the available tools in excel to identify duplicates (conditional formatting), and then "remove duplicates" but when I do that Mike, Bill, and Jim are deleted and all of my data shifts around and it doesn't work for what I am trying to do.
I am wondering if there is a formula that I can possibly use? or perhaps a macro/vba? Any help would be greatly appreciated! Thank you.
name | column_1 | column_2 |
---|---|---|
bill | ||
jim | ||
mike | ||
sandra | ||
mike | x | |
bill | x | x |
dave | x | x |
jim | x |
name | column_1 | column_2 |
---|---|---|
bill | ||
jim | ||
mike | ||
sandra | ||
x | ||
x | x | |
dave | x | x |
x |
CodePudding user response:
Create a helper column and put the following formula into all of its cells:
=COUNTIF(A$2:A2;A2)-1
All entries with a duplicate (in a row above it) will contain a value > 0
CodePudding user response:
I have your data starting in Column A1 with a Header (called Name in A1). Then I use the formula- in Column B2 =COUNTIF($A$2:A2,A2)
* kindly note, that the 1st part of the range is 'Anchored' with the absolute reference aka the '$' sign. this will start at the top of the range and when copied down will include the 1st cell (with Bill in it).
so in column B, it looks to Col A for how many times that name occurs. I would filter on Column B and show all cells NOT equal to 1 (uncheck the filter box for '1') and remove the rows and you will be left with the 1st occurance of the name.
when you delete, delete entire rows in filtered data (this will remove the spaces