Conditional Removal of Duplicates from Excel

agatina11

New Member
Joined
Jun 12, 2018
Messages
8
Hey,

I'd appreciate help with 1 excel spreadsheet and duplicate values that I would like to remove.

I've got information about some collections at specific suppliers for each week of the year.

Example

Week Supplier Missed collection
Week 1 SU1 YES
Week 1 SU2 YES
Week 1 SU3 YES
Week 1 SU1 YES

So if I use the countifs function I would get 4 missed collection, however, SU1 is repeated 2 times. I am not sure if I can remove duplicates as that would remove that SU from other weeks on that report ( from a query). Unless there is an option to remove the duplicated suppliers form a specific week

Thanks in advance

Agata
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to Mr Excel forum

Do you really want to remove the duplicates or just count unique rows depending on conditions? If the former try Data > Remove duplicates; if the later you can use a formula to count unique without removing the duplicates.
Please, clarify.


M.
 
Last edited:
Upvote 0
Welcome to Mr Excel forum

Do you really want to remove the duplicates or just count unique rows depending on conditions? If the former try Data > Remove duplicates; if the later you can use a formula to count unique without removing the duplicates.
Please, clarify.


M.

Hi,

thanks for a swift reply. As it's a table ran from a query, I'm not able to remove duplicates.

Is there a formula to count unique values ?

Thanks
Agata
 
Upvote 0
You need an array formula

Something like this

A
B
C
D
E
F
G
1
Week​
Supplier​
Missed colection​
Week​
Missed colection​
Count Unique​
2
Week 1​
SU1​
YES​
Week 1​
YES​
3​
3
Week 1​
SU2​
YES​
4
Week 1​
SU3​
YES​
5
Week 1​
SU1​
YES​
6
Week 1​
SU4​
NO​
7

Criteria in E2:F2

Array formula in G2
=SUM(IF(FREQUENCY(IF(A2:A10=E2,IF(C2:C10=F2,MATCH(B2:B10,B2:B10,0))),ROW(B2:B10)-ROW(B2)+1),1))
confirmed with Ctrl+Shift+Enter simultaneously, not just Enter

Hope this helps

M.
 
Upvote 0
You need an array formula

Something like this

A
B
C
D
E
F
G
1
Week​
Supplier​
Missed colection​
Week​
Missed colection​
Count Unique​
2
Week 1​
SU1​
YES​
Week 1​
YES​
3​
3
Week 1​
SU2​
YES​
4
Week 1​
SU3​
YES​
5
Week 1​
SU1​
YES​
6
Week 1​
SU4​
NO​
7

<tbody>
</tbody>


Criteria in E2:F2

Array formula in G2
=SUM(IF(FREQUENCY(IF(A2:A10=E2,IF(C2:C10=F2,MATCH(B2:B10,B2:B10,0))),ROW(B2:B10)-ROW(B2)+1),1))
confirmed with Ctrl+Shift+Enter simultaneously, not just Enter

Hope this helps

M.


Hi!

Thanks for help. However this didn't work for me. I get an error that there is a problem with this formula. Also I am taking that info from a few different sheets, and there are much more suppliers, so I want to have a unique count for any supplier that would appear. Not sure I explain myself good.

ANyhow! thanks for help :)

Best
Agata
 
Upvote 0
Agata,

The formula should have worked - it's a well known formula. What error have you gotten?
Try to show us a small data sample similar to your real scenario.

M.
 
Upvote 0
Agata,

The formula should have worked - it's a well known formula. What error have you gotten?
Try to show us a small data sample similar to your real scenario.

M.
HI M,

SUPPLIERWeekPick up dayAgreed Pickedup dayDelaymisscollection
SU122220X
SU2222202
SU3222202
SU4222202
SU5222202
SU6222202
SU7222202
SU8222202
SU9223303
SU10223303
SU11223303
SU12223303
SU13223303
SU14223303
SU15223303
SU16223303
SU17223303
SU18223303
SU122330X
SU20223303
SU21223303
SU22223303
SU23223303
SU24223303
SU122630X
SU26223303
SU122330X

<colgroup><col width="204" style="width:153pt"> <col width="64" style="width:48pt" span="5"> </colgroup><tbody>
</tbody>


So I'd like to count the missed collection, and total number should be 1, as the same supplier appears few times.

Cab you help? I can't get it working :?

Thanks!
Agata
 
Upvote 0
Assuming your data in A1:F28, headers in row 1 try this array formula
=SUM(IF(FREQUENCY(IF(F2:F28="x",MATCH(A2:A28,A2:A28,0)),ROW(A2:A28)-ROW(A2)+1),1))
Ctrl+Shift+Enter

M.
 
Upvote 0
HI Marcelo,
Thanks for help. How can I use the result ? I got as a result this:
SUWeekMissed collectionRESULT
SU222X8
SU321X8
SU421X8
SU523X8
SU623X7
SU723X7
SU120X4
SU120X4
SU120X4
SU120X4
SU120X4
SU820X1

<colgroup><col width="211" style="width:158pt"> <col width="64" style="width:48pt"> <col width="168" style="width:126pt"> <col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>

Thanks!
Agata
 
Upvote 0
Do you want something like this?


A
B
C
D
E
F
G
1
SU​
Week​
Missed collection​
Week​
Missed colection​
Result​
2
SU2​
22​
X​
20​
x​
2​
3
SU3​
21​
X​
21​
x​
2​
4
SU4​
21​
X​
22​
x​
1​
5
SU5​
23​
X​
23​
x​
3​
6
SU6​
23​
X​
7
SU7​
23​
X​
8
SU1​
20​
X​
9
SU1​
20​
X​
10
SU1​
20​
X​
11
SU1​
20​
X​
12
SU1​
20​
X​
13
SU8​
20​
X​
14

Criteria in columns E:F

Array formula in G2 copied down
=SUM(IF(FREQUENCY(IF(B$2:B$13=E2,IF(C$2:C$13=F2,MATCH(A$2:A$13,A$2:A$13,0))),ROW(A$2:A$13)-ROW(A$2)+1),1))
Ctrl+Shift+Enter

M.
 
Upvote 0

Forum statistics

Threads
1,216,796
Messages
6,132,742
Members
449,756
Latest member
AdkinsP

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