Countif without duplicates?

Jed Shields

Active Member
Joined
Sep 7, 2011
Messages
283
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I'm trying to do a count of records that are "In Process" in column J, but only count once for each PR reference in column Q. For example, there may be 4 "In Process" records, but three have PR1 and one has PR2, so I'd want to count 2 i.e. not count the duplicates.

Cheers,

Jed
 
Just to be safe, could you post a small sample along with desired result?


Okay, to simplify I'll use cols A:E

[TABLE="width: 285"]
<colgroup><col width="102" style="width: 77pt; mso-width-source: userset; mso-width-alt: 3640;"> <col width="76" style="width: 57pt; mso-width-source: userset; mso-width-alt: 2702;"> <col width="73" style="width: 55pt; mso-width-source: userset; mso-width-alt: 2588;"> <col width="64" style="width: 48pt;" span="2"> <tbody>[TR]
[TD="width: 102, bgcolor: white"]A[/TD]
[TD="width: 76, bgcolor: white"]B[/TD]
[TD="width: 73, bgcolor: white"]C[/TD]
[TD="width: 64, bgcolor: white"]D[/TD]
[TD="width: 64, bgcolor: white"]E[/TD]
[/TR]
[TR]
[TD="bgcolor: white"]Status[/TD]
[TD="bgcolor: white"]Date[/TD]
[TD="bgcolor: white"]Dept[/TD]
[TD="bgcolor: white"]PO No[/TD]
[TD="bgcolor: white"]Days
[/TD]
[/TR]
[TR]
[TD="width: 102, bgcolor: white"]In Process[/TD]
[TD="bgcolor: white"]01/02/2019[/TD]
[TD="bgcolor: white"]IT[/TD]
[TD="width: 64, bgcolor: #92D050"]PO1[/TD]
[TD="bgcolor: #92D050"]2 Days[/TD]
[/TR]
[TR]
[TD="width: 102, bgcolor: white"]In Process[/TD]
[TD="bgcolor: white"]01/01/2019[/TD]
[TD="bgcolor: white"]Sales[/TD]
[TD="width: 64, bgcolor: #E26B0A"]PO3[/TD]
[TD="bgcolor: #E26B0A"]5 Days[/TD]
[/TR]
[TR]
[TD="width: 102, bgcolor: white"]In Process[/TD]
[TD="bgcolor: white"]31/01/2019[/TD]
[TD="bgcolor: white"]IT[/TD]
[TD="width: 64, bgcolor: #92D050"]PO2[/TD]
[TD="bgcolor: #92D050"]1 Day[/TD]
[/TR]
[TR]
[TD="width: 102, bgcolor: white"]In Process[/TD]
[TD="bgcolor: white"]13/02/2019[/TD]
[TD="bgcolor: white"]IT[/TD]
[TD="width: 64, bgcolor: transparent"]PO2[/TD]
[TD="bgcolor: transparent"]1 Day[/TD]
[/TR]
[TR]
[TD="width: 102, bgcolor: white"]On Hold[/TD]
[TD="bgcolor: white"]10/01/2019[/TD]
[TD="bgcolor: white"]Sales[/TD]
[TD="width: 64, bgcolor: white"]PO4[/TD]
[TD="bgcolor: white"]1 Day[/TD]
[/TR]
</tbody>[/TABLE]



I'm expecting to see:

[TABLE="width: 160"]
<colgroup><col width="76" style="width: 57pt; mso-width-source: userset; mso-width-alt: 2702;"> <col width="73" style="width: 55pt; mso-width-source: userset; mso-width-alt: 2588;"> <col width="64" style="width: 48pt;"> <tbody>[TR]
[TD="width: 76, bgcolor: transparent"] [/TD]
[TD="width: 73, bgcolor: white"]Unique PRs
[/TD]
[TD="width: 64, bgcolor: white"]Ave Days
[/TD]
[/TR]
[TR]
[TD="bgcolor: #92D050"]IT[/TD]
[TD="bgcolor: transparent"]2[/TD]
[TD="bgcolor: transparent"]1.5 Days
[/TD]
[/TR]
[TR]
[TD="bgcolor: #E26B0A"]Sales
[/TD]
[TD="bgcolor: transparent"]1[/TD]
[TD="bgcolor: transparent"]5 Days[/TD]
[/TR]
</tbody>[/TABLE]

So the third IT isn't counted as it is a repeat of PO2.

The second Sales isn't counted as it is On Hold.

All PO numbers that are the same code will have the same number of days
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Book1
ABCDEFGHI
1StatusDateDeptPO NoDaysUnique PRsAve Days
2In Process2/1/2019ITPO12IT21.5
3In Process1/1/2019SalesPO35Sales15
4In Process1/31/2019ITPO21
5In Process2/13/2019ITPO21
6On Hold1/10/2019SalesPO41
Sheet1


In H2 control+shift+enter, not just enter, and copy down:

=SUM(IF(FREQUENCY(IF($A$2:$A$6="in process",IF($D$2:$D$6<>"",IF($C$2:$C$6=G2,MATCH($D$2:$D$6,$D$2:$D$6,0)))),ROW($D$2:$D$6)-ROW($D$2)+1),1))

In I2 control+shift+enter, not just enter, and copy down:

=AVERAGE(IF(FREQUENCY(IF($A$2:$A$6="in process",IF($D$2:$D$6<>"",IF($C$2:$C$6=G2,MATCH($D$2:$D$6,$D$2:$D$6,0)))),ROW($D$2:$D$6)-ROW($D$2)+1),$E$2:$E$6))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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