Unique entries updated dynamically

vacation

Board Regular
Joined
Dec 6, 2003
Messages
56
Hi,

I have 5,000 rows of data in sheet1. Here is a sample:
Bob, ...
Tom, ...
Bob, ...
Pat, ...
Tom, ...

I would like to have:
1. Unique entries in column B of sheet2
2. These uinque entries come from column A of sheet1
3. So sheet2 column B would contain Bob, Tom, Pat
4. Every time the data is updated in sheet1 then sheet2 should be automatically updated with these non-duplicates from sheet1

How can I do this?

Thanks,
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Column > 1 Then Exit Sub
Range("a1", Range("a65536").End(xlUp)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets("Sheet2").Range("B1" _
        ), Unique:=True
End Sub

Right-click on sheet1 and select view code, then paste the above code into the worksheet
 
Upvote 0
Applying Advaced Filter thru a Worksheet_Change event is attractive.

A formula approach is also possible...

Sheet1
Book1
ABCD
112
2Name0
3Bob1
4Tom2
5Bob 
6Pat3
7Tom 
8 
9Jacob4
10Jon5
11Brian6
12Jon 
13
Sheet1


A1:

=MATCH(REPT("z",255),Sheet1!A:A)

which delivers a value that can be used by code which copies formulas down.

B2 must house a 0.

B3 houses

=IF((A3<>"")*ISNA(MATCH(A3,$A2:A$2,0)),LOOKUP(9.99999999999999E+307,$B$2:B2)+1,"")

which is copied down (manually or by code).

Sheet2
Book1
BCDE
16
2Name
3Bob
4Tom
5Pat
6Jacob
7Jon
8Brian
9 
10 
Sheet2


B1 houses:

=LOOKUP(9.99999999999999E+307,Sheet1!B:B)

whose result can also be used code which would copy formulas down.

B3 houses:

=IF(ROW()-ROW($B$3)+1<=$B$1,INDEX(Sheet1!A:A,MATCH(ROW()-ROW($B$3)+1,Sheet1!B:B)),"")

which is copied down either manually or by code.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,803
Members
449,048
Latest member
greyangel23

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