Unique list from a list of duplicates based on a condition

Shweta

Well-known Member
Joined
Jun 5, 2011
Messages
514
Hi All,

I have two columns, one with advisors name and other with their batch number. Say, column A and column B.

ColAColB
Shwetabatch 21
Shwetabatch 21
Sweetybatch 20
Sweetybatch 20
Bodhikabatch 21
Rahulbatch 21
Bodhikabatch 21
Rahulbatch 21
Bodhikabatch 21

<COLGROUP><COL style="WIDTH: 48pt" span=2 width=64><TBODY>
</TBODY>

In cell C1, I have a data validation list having batch numbers

In column D, I want the unique names from col A based on the selection in Cell C1. For example if I select batch 21 in validation list, I want all the unique name from col A in column D...and same for all batches.

Note: - list is dynamic.

Please help me with a excel formula for the same.

Thanks in advance!

Regards,
Shweta
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
something like........

Excel 2010
ABCD
1NameBatchbatch 21Extract
2weazelbatch 21weazel
3weazelbatch 21Bodhika
4Sweetybatch 20Rahul
5Sweetybatch 20joe
6Bodhikabatch 20test 2
7Rahulbatch 21
8Bodhikabatch 21
9Rahulbatch 21
10Bodhikabatch 21
11joebatch 21
12testbatch 20
13test 2batch 21
14
15
16
17
18
19
20

<tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
D2{=IFERROR(INDEX($A$2:$A$20,SMALL(IF(FREQUENCY(IF($B$2:$B$20=$C$1,MATCH($A$2:$A$20,$A$2:$A$20,0)),ROW($A$2:$A$20)-ROW($A$2)+1),ROW($A$2:$A$20)-ROW($A$2)+1),ROWS($D$2:D2))),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Nice reply Weazel. This is a great solution.



something like........

Excel 2010
ABCD
1NameBatchbatch 21Extract
2weazelbatch 21weazel
3weazelbatch 21Bodhika
4Sweetybatch 20Rahul
5Sweetybatch 20joe
6Bodhikabatch 20test 2
7Rahulbatch 21
8Bodhikabatch 21
9Rahulbatch 21
10Bodhikabatch 21
11joebatch 21
12testbatch 20
13test 2batch 21
14
15
16
17
18
19
20

<tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
D2{=IFERROR(INDEX($A$2:$A$20,SMALL(IF(FREQUENCY(IF($B$2:$B$20=$C$1,MATCH($A$2:$A$20,$A$2:$A$20,0)),ROW($A$2:$A$20)-ROW($A$2)+1),ROW($A$2:$A$20)-ROW($A$2)+1),ROWS($D$2:D2))),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Or you can use this regular (non-array formula)

in D2

=IFERROR(INDEX($A$2:$A$20,MATCH(0,INDEX(COUNTIF($D$1:D1,$A$2:$A$20),,),)),"")
 
Upvote 0

Forum statistics

Threads
1,203,388
Messages
6,055,129
Members
444,763
Latest member
Jaapaap

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