formula or macro?

bigK

New Member
Joined
Aug 7, 2007
Messages
49
I'm trying to populate a worksheet (column A) with part numbers from a previous worksheet the only problem i have is that on the original there are multiples of the same thing and i want to only show one of them (if there are multiple)

would a formula or a macro be best for this ... and what form would either a formula or macro take

cheers
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

QuietRiot

Well-known Member
Joined
May 18, 2007
Messages
1,079
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. MacOS
i would use VBA

Code:
Sub DeleteDups() 
     
    Dim x               As Long 
    Dim LastRow         As Long 
     
    LastRow = Range("A65536").End(xlUp).Row 
    For x = LastRow To 1 Step -1 
        If Application.WorksheetFunction.CountIf(Range("A1:A" & x), Range("A" & x).Text) > 1 Then 
            Range("A" & x).EntireRow.Delete 
        End If 
    Next x 
     
End Sub

you want to get rid of duplicates in column A correct?
 
Upvote 0

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
I'm trying to populate a worksheet (column A) with part numbers from a previous worksheet the only problem i have is that on the original there are multiples of the same thing and i want to only show one of them (if there are multiple)

would a formula or a macro be best for this ... and what form would either a formula or macro take

cheers

Run Data|Filter|Advanced Filter on the data from within the destination sheet with "Unique records only" checked...
 
Upvote 0

QuietRiot

Well-known Member
Joined
May 18, 2007
Messages
1,079
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. MacOS
I'm trying to populate a worksheet (column A) with part numbers from a previous worksheet the only problem i have is that on the original there are multiples of the same thing and i want to only show one of them (if there are multiple)

would a formula or a macro be best for this ... and what form would either a formula or macro take

cheers

Run Data|Filter|Advanced Filter on the data from within the destination sheet with "Unique records only" checked...

that works too, only that doesn't delete them

easier for you if your not familiar with code though
 
Upvote 0

Forum statistics

Threads
1,191,188
Messages
5,985,195
Members
439,947
Latest member
fabiannic

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
Top