Countif multiple criteria met but if criteria met twice for duplicate value only count 1

Chechel

New Member
Joined
Oct 19, 2022
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
I just can't seem to write the formula for this one. I would appreciate assistance. I've tried to explain below what I want. Final result should be 3. I've stated criteria below - but the way I'm going about it could be wrong.
Can you help? Thank you.



IDPartOHUsageResultColumnCount if
1A00Don't CountAID equals Same
1B00BPart equals A or B
2A10Don't CountCOH equals 0 for both A and B
2B01DUsage is greater than 0 for either A or B
3A00Count 1
3B01
4A01Count 1
4B01
5A10Don't Count
5B00
6A11Don't Count
6B10
7A11Don't Count
7B00
8A01Don't Count
8B10
9A00Count 1
9B01
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I added two helper columns. The first one must be 0 and the next one above 0 to count, then divide by 2.

Book1
ABCDEFGHIJ
1IDPartOHUsageOHcalcUsageCalcResultColumnCount if
21A0000Don't CountAID equals Same
31B0000BPart equals A or B
42A1011Don't CountCOH equals 0 for both A and B
52B0111DUsage is greater than 0 for either A or B
63A0001Count 1
73B01013
84A0102Count 1
94B0102
105A1010Don't Count
115B0010
126A1121Don't Count
136B1021
147A1111Don't Count
157B0011
168A0111Don't Count
178B1011
189A0001Count 1
199B0101
Sheet1
Cell Formulas
RangeFormula
E2:E19E2=SUMIFS($C$2:$C$19,$A$2:$A$19,A2)
F2:F19F2=SUMIFS($D$2:$D$19,$A$2:$A$19,A2)
J7J7=COUNTIFS(E2:E19,0,F2:F19,">"&0)/2
 
Upvote 0
Solution
Thank you for your help. I'm looking for a way to write the formula without helper columns. I'm using a separate worksheet to calculate a work order which has 8000 parts and about 600 parts that can be alternatives. The database I am using can be as much as 130000 lines long, - it's much larger than the sample I gave, and I cannot add helper columns to it. In this database there are way more than just two different parts.
 
Upvote 0
This sounds like something that requires Power Query (where you can add "virtual" helper columns) or VBA, based on the high number of rows alone.
 
Upvote 0
Hello, I am trying to add the helper columns, but I need a way to pull out just part A or B among parts and exclude all other parts. Can you help?
 
Upvote 0
You can filter for A and B in Power Query. I think it really is the best option for what you are trying to do, and much easier to learn than formulas.
 
Upvote 0
You can filter for A and B in Power Query. I think it really is the best option for what you are trying to do, and much easier to learn than formulas.
Thank you. I added 3 helper columns. I assigned a code to each part with alternatives. So alternatives have the same code. I added your two helper columns as well. Thank you for leading me in the right direction.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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