Formula to Remove Duplicates from List... IF

tobermory

New Member
Joined
Jun 4, 2012
Messages
46
Hello there,

I know you can remove duplicates with the 'Remove Duplicates' tab, however is there a way to do it formula wise, including an if statement?

For instance, in the dataset below, I need the unique values for each fruit. So, for instance, the unique values for Oranges would be 1, 2 and 3.

Apples - 1, 2, 3, 4, 5
Pears - 1, 2

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"][TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]Col A[/TD]
[TD="class: xl65, width: 64"]Col B[/TD]
[/TR]
[TR]
[TD="class: xl65"]Oranges[/TD]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65"]Pears[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Pears[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Oranges[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Oranges[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Apples[/TD]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65"]Apples[/TD]
[TD="class: xl65, align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65"]Apples[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Pears[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Pears[/TD]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65"]Oranges[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Oranges[/TD]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65"]Apples[/TD]
[TD="class: xl65, align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65"]Apples[/TD]
[TD="class: xl65, align: right"]5[/TD]
[/TR]
[TR]
[TD="class: xl65"]Apples[/TD]
[TD="class: xl65, align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65"]Oranges[/TD]
[TD="class: xl65, align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65"]Pears[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]Pears[/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="width: 64, align: right"][/TD]
[/TR]
</tbody>[/TABLE]

Is there a way to achieve this?

Many Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hello, can you use a Pivot Table?

Just add both Column fields to the Rows Area and you have it.
 
Upvote 0
Hello, can you use a Pivot Table?

Just add both Column fields to the Rows Area and you have it.

Thanks for your reply.

Yes I'm aware of PivotTables and how to do this, however for purpose of what I'm trying to achieve a formula'ed version would be more beneficial as I would be using the formula fairly regularly and would like it to update automatically rather than having to refresh the PivotTable all the time.
 
Upvote 0
Ok, then I think you need a bit more information
For your output you show:
Apples - 1, 2, 3, 4, 5
Pears - 1, 2
Do you expect to have this is one cell, just like you show,or is each item in a separate cell across a row or can it be in two columns etc.?
What version of Office / Excel do you have?
If 2016, which version?
I believe you will be looking at a fairly complex array formula. If I had a lot of data I would go with the Pivot Table / Power Query solution and use a macro to automatically update itif that was important.
For the array formula, Excelisfun has a lot of videos that show some complicated formulas to extract unique lists, like here for several examples:
https://www.youtube.com/watch?v=J6yeTUFkLzQ
 
Last edited:
Upvote 0
Since your column B values are numeric, you could try this. Formula in E2 is copied across and down.

Excel Workbook
ABCDEFG
1Col ACol BOrangesApplesPears
2Oranges2111
3Pears1222
4Pears133
5Oranges14
6Oranges15
7Apples2
8Apples4
9Apples1
10Pears1
11Pears2
12Oranges1
13Oranges2
14Apples4
15Apples5
16Apples3
17Oranges3
18Pears1
19Pears1
Unique Values
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

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