PDA

View Full Version : [SOLVED:] VBA Create Unique Distinct List From Three columns



hobbiton73
08-26-2013, 11:46 PM
Morning, I was wondering whether someone may be able to help me please.

I have the following table layout on my sheet called "Master":




Column B (Task)

Column C (ID)

Column D (Work Area)



Row 4

Management

10

Test



Row 5

SME Work

5

Requirements



Row 6

Management

10

Test



Row 7

PMR

3

Test



Row 8

Management

2

Test



Row 8

Personnel

3

Requirements



Row 9

Personnel

3

Requirements



Row10

Personnel

8

Requirements




I then have a further 2 'Destination' sheets called "Requirements" and "Test",with same layout as above.

What I'm trying to do is create unique distinct lists in each of the 'Destination' sheets using information from the "Master" sheet but only if there is a match on all of three values.

So the output of the "Test" 'Destination' sheet would be:



Column B (Task)

Column C (ID)

Column D (Work Area)



Row 4

Management

10

Test



Row 5

PMR

3

Test



Row 6

Management

2

Test




and the output of the "Requirements" 'Destination' sheet would be:



Column B (Task)

Column C (ID)

Column D (Work Area)



Row 4

Personnel

3

Requirements



Row 5

Personnel

8

Requirements



Row 6

SME Work

5

Requirements




From tutorials I've found online, I can create a small script which looks at creating a unique list from one column but not all three.

I just wondered whether someone may be able to offer some guidance on how I may achieve this.

Many thanks

p45cal
08-27-2013, 04:56 AM
I would autofilter Master sheet on just column D and copy to the destination sheet, then on the destination remove duplicates(Excel 2007 and later) based on all three columns

hobbiton73
08-27-2013, 05:18 AM
HI @p45cal, thank you vey much for this, I'll look into it.

Kind regards

snb
08-27-2013, 07:21 AM
I'd say advanced filter as been designed exactly for that purpose.