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

ABCDE
StatusDateDeptPO NoDays
In Process01/02/2019ITPO12 Days
In Process01/01/2019SalesPO35 Days
In Process31/01/2019ITPO21 Day
In Process13/02/2019ITPO21 Day
On Hold10/01/2019SalesPO41 Day
<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> </tbody>



I'm expecting to see:

Unique PRs
Ave Days
IT21.5 Days
Sales
15 Days
<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> </tbody>

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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

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,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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