Formula for removing duplicates?

agerrard

Active Member
Joined
Apr 4, 2005
Messages
406
Hi All,

Please see my example below:

This is my raw data.


Excel 2007
BCDEF
3RAW DATA
4Product NameTOTALSEGMENTBRANDCUSTOMER
5Product1TotalSegment1Brand1Customer1
6Product2TotalSegment1Brand3Customer1
7Product3TotalSegment2Brand1Customer1
8Product4TotalSegment2Brand2Customer1
9Product5TotalSegment2Brand2Customer1
10Product1TotalSegment1Brand1Customer2
11Product2TotalSegment1Brand1Customer2
12Product6TotalSegment2Brand2Customer2
13Product7TotalSegment1Brand3Customer2
14Product8TotalSegment2Brand1Customer2
15Product1TotalSegment1Brand1Customer3
16Product2TotalSegment1Brand2Customer3
17Product9TotalSegment2Brand4Customer3
18Product3TotalSegment2Brand5Customer3
19Product10TotalSegment1Brand6Customer3
mapping (3)


I want to somehow get Excel to remove the duplicates and to only show all the unique values (see my example below):


Excel 2007
HIJKL
3OUTPUT
4Product NameTOTALSEGMENTBRANDCUSTOMER
5Product1TotalSegment1Brand1Customer1
6Product2Segment2Brand2Customer2
7Product3Brand3Customer3
8Product4Brand4
9Product5Brand5
10Product6Brand6
11Product7
12Product8
13Product9
14Product10
mapping (3)


I know you can remove duplicates in the data field, but i need this to be a formula as the list will change etc...

Hope this is enough info makes sense.

Cheers,
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
If data is setup like this:


ABCDEFGHIJKLM
1
2RAW DataOutput
3Product NameTotalSegmentBrandCustomerProduct NameTotalSegmentBrandCustomer
4
5Product1TotalSegment1Brand1Customer1Product1TotalSegment1Brand1Customer1
6Product2TotalSegment1Brand3Customer1Product2Segment2Brand2Customer2
7Product3TotalSegment2Brand1Customer1Product3Brand3Customer3
8Product4TotalSegment2Brand2Customer1Product4Brand4
9Product5TotalSegment2Brand2Customer1Product5Brand5
10Product1TotalSegment1Brand1Customer2Product6Brand6
11Product2TotalSegment1Brand1Customer2Product7
12Product6TotalSegment2Brand2Customer2Product8
13Product7TotalSegment1Brand3Customer2Product9
14Product8TotalSegment2Brand1Customer2Product10
15Product1TotalSegment1Brand1Customer3
16Product2TotalSegment1Brand2Customer3
17Product9TotalSegment2Brand4Customer3
18Product3TotalSegment2Brand5Customer3
19Product10TotalSegment1Brand6Customer3
20

<tbody>
</tbody>


Use this formula in H5 and paste it down and in right till column L :

Code:
=IF(ROWS(H$5:H5)<=SUMPRODUCT(1/COUNTIF(B$5:B$19,B$5:B$19)),INDEX(B$5:B$19,MATCH(0,COUNTIF(H$4:H4,B$5:B$19),0)),"")

As this is an array formula, it requires Ctrl+shift+enter.
 
Last edited:
Upvote 0
A set up that is expected to be faster...

Row\Col
A​
B​
C​
D​
E​
H​
I​
J​
K​
L​
3​
10
1
2
6
3
4​
Product NameTOTALSEGMENTBRANDCUSTOMERProduct NameTOTALSEGMENTBRANDCUSTOMER
5​
Product1TotalSegment1Brand1Customer1Product1TotalSegment1Brand1Customer1
6​
Product2TotalSegment1Brand3Customer1Product2Segment2Brand3Customer2
7​
Product3TotalSegment2Brand1Customer1Product3Brand2Customer3
8​
Product4TotalSegment2Brand2Customer1Product4Brand4
9​
Product5TotalSegment2Brand2Customer1Product5Brand5
10​
Product1TotalSegment1Brand1Customer2Product6Brand6
11​
Product2TotalSegment1Brand1Customer2Product7
12​
Product6TotalSegment2Brand2Customer2Product8
13​
Product7TotalSegment1Brand3Customer2Product9
14​
Product8TotalSegment2Brand1Customer2Product10
15​
Product1TotalSegment1Brand1Customer3
16​
Product2TotalSegment1Brand2Customer3
17​
Product9TotalSegment2Brand4Customer3
18​
Product3TotalSegment2Brand5Customer3
19​
Product10TotalSegment1Brand6Customer3

Define Ivec in Name Manager as referring to:
Rich (BB code):
=ROW(mapping!$A$5:$E$19)-ROW(mapping!$A$5)+1

In H3 control+shift+enter, not just enter, and copy across:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(1-(A$5:A$19=""),MATCH(A$5:A$19,A$5:A$19,0)),Ivec),1))

In H5 control+shift+enter, copy across, and down:
Rich (BB code):
=IF(ROWS(H$5:H5)>H$3,"",INDEX(A$5:A$19,SMALL(IF(FREQUENCY(IF(1-(A$5:A$19=""),
   MATCH(A$5:A$19,A$5:A$19,0)),Ivec),Ivec),ROWS(H$5:H5))))
 
  • Like
Reactions: snd
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

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