Duplicates, SUMPRODUCT and COUNTIF

Harveux

New Member
Joined
Aug 1, 2017
Messages
4
Hi guys, any help on this would be appreciated =) Hope I can help others at some point too!

I am creating a count separated into 3 categories: 'Late', 'Not Late', and 'Mix'

Where exact duplicates exist I want them to be counted once in 'Late' or 'Not Late' (depending on the status of duplicate)
When a duplicate has two different statuses (i.e. Late and Not Late) I want them to be counted in 'Mix'
Unique ID's should have their statuses counted into their respective groups.

The formula I have so far for the 'late' column is:

=SUMPRODUCT(((B2:B16="late")*(C2:C16="blue"))/(COUNTIFS(A2:A16, A2:A16, B2:B16, "late", C2:C16, "blue")+((B2:B16<>"late")+(C2:C16<>"blue"))))

This is handy if there are exact duplicates, but I need it to exclude from the count all duplicates under one ID if one of the rows contains a different status.

Top left is cell A1
Result should be
Blue:
Late: 1
On Time: 1
Mixed: 1
[TABLE="class: grid, width: 250"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Status[/TD]
[TD]Category[/TD]
[/TR]
[TR]
[TD]1423[/TD]
[TD]Late[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]1423[/TD]
[TD]Late[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]1423[/TD]
[TD]Late[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]5124[/TD]
[TD]Late[/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]5124[/TD]
[TD]Late[/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]2341[/TD]
[TD]On Time[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]1111[/TD]
[TD]On Time[/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]1212[/TD]
[TD]On Time[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]1212[/TD]
[TD]Late[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]1111[/TD]
[TD]Late[/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]5124[/TD]
[TD]Late[/TD]
[TD]Red[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
What constitutes an "exact duplicate" ?

Just the ID repeating or ID AND category ?

And what are you expecting your output to look like based on that data?
 
Last edited:
Upvote 0
Hi,

try this as possible solution:


Excel 2016 (Windows) 64 bit
ABC
1IDStatusCategory
21423LateBlue
31423LateBlue
41423LateBlue
55124LateRed
65124LateRed
72341On TimeBlue
81111On TimeRed
91212On TimeBlue
101212LateBlue
111111LateRed
125124LateRed
13
14
15BlueLate1
16On Time1
17Mixed1
Sheet1
Cell Formulas
RangeFormula
C15{=SUM(--(FREQUENCY(IF((C2:C12=A15)*(B2:B12=B15),MATCH(B2:B12,B2:B12,0)),ROW(B2:B12)-ROW(B2)+1)>0))}
C16{=SUM(--(FREQUENCY(IF((C2:C12=A15)*(B2:B12="On Time"),MATCH(B2:B12,B2:B12,0)),ROW(B2:B12)-ROW(B2)+1)>0))}
C17{=SUM(--(FREQUENCY(IF((C2:C12=A15),MATCH(A2:A12,A2:A12,0)),ROW(B2:B12)-ROW(B2)+1)>0))-C16-C15}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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