CountIFs with multiple criteria and duplication

sammipd

Board Regular
Joined
Jun 6, 2010
Messages
67
Within a larger spreadsheet I have a Type (alpha, beta) column and Code 1 and Code 2 columns. Code columns are numeric from 1.1-7.9. I need to determine the number of alpha's who are coded 5.0-5.9 in either column without duplication. Some alphas are coded 5.0-5.9 in both columns but should only be counted here once. There was a similar thread earlier today and I couldn’t tweak the responses to fit this problem. Can someone help?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
A small data sample (~10 rows) along with expected result(s) would be helpful.

M.
 
Upvote 0
The question is how many Alpha's are coded in the 5.0-5.9 range. The answer should be 4 (lines 1,2,4,6).
Although lines 4 and 6 have 2 codes in the proper range, they should only be counted once. How can I make this work?

TypeCode1Code2
1Alpha5.73.2
2Alpha1.45.9
3Beta5.43.2
4Alpha5.35.8
5Beta6.85.2
6Alpha5.35.6
7Beta5.32.5
8Alpha3.46.5

<colgroup><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
If your Code 1 and Code 2 columns are adjacent, you can use the I2 formula. If not, the J2 formula should work.

ABCDEFGHIJ
1TypeCode 1Code 2TypeLower limitUpper LimitUnique Count
21Alpha5.73.2alpha55.944
32Alpha1.45.9
43Beta5.43.2
54Alpha5.35.8
65Beta6.85.2
76Alpha5.35.6
87Beta5.32.5
98Alpha3.46.5

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet16

Array Formulas
CellFormula
I2{=SUM(SIGN(MMULT(IF(($C$2:$D$9>=G2)*($C$2:$D$9<=H2)*($B$2:$B$9=F2),1,0),{1;1})))}
J2{=SUM(IF((($C$2:$C$9>=G2)*($C$2:$C$9<=H2)+($D$2:$D$9>=G2)*($D$2:$D$9<=H2))*($B$2:$B$9=F2),1))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



Both are array formulas. Also, you can incorporate the F2:H2 values in the formula itself if you like.
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

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