Remove Duplicates in Second Column, but refresh if new header in First Column

WPitt

New Member
Joined
Dec 30, 2014
Messages
2
Hi all,

I've got a list of data in column A that has duplicates clustered together. Column A could have duplicates, but after the cluster of duplicates, I know the values to be unique. Column B has duplicates, that are repeated, and need to be visible if the data in column A changes. I'd like to create blanks where repeated, but column B needs to be able to repeat single use items.


A B
Red 1
Red 2
Red 3
Red 4
Green 1
Green 2
Green 3
Yellow 1
Yellow 2





Ideal scenario:
A B
Red 1
2
3
4
Green 1
2
3
Yellow 1
2



I tried using this IF statement, which works well for column A, but eliminates the duplicate instances in column B, which I need to exist if the data in column A changes.
=IF(COUNTIF($A$2:A2,A2)>1,"",A2)

Any help would be much appreciated.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Welcome to the MrExcel board!

You could try this macro in a copy of your workbook.

Rich (BB code):
Sub RemoveDupesColA()
  Application.ScreenUpdating = False
  With Range("C2:C" & Range("A" & Rows.Count).End(xlUp).Row)
    .Formula = "=IF(A2=A1,1,"""")"
    On Error Resume Next
    .SpecialCells(xlFormulas, xlNumbers).Offset(, -2).ClearContents
    On Error GoTo 0
    .ClearContents
  End With
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks MrExcelMVP! I was able to add your code as a module in my workbook. I added 3 other instances of the code, and modified the "With Range(C2:C" portion to run in additional columns. Using an order of operations, I was able to produce the columns necessary, then paste them into a new worksheet and merge the columns together. Appreciate the help!
 
Upvote 0
Cheers. Glad you got what you wanted in the end. :)
 
Upvote 0

Forum statistics

Threads
1,215,483
Messages
6,125,065
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top