Counting multiple conditions in same range

TBertot107

New Member
Joined
Jun 3, 2024
Messages
13
Office Version
  1. 365
Platform
  1. Windows
=SUMPRODUCT(COUNTIF($B$2:$F$1000,$I$2))-SUMPRODUCT(COUNTIF($B$2:$F$1000,K$1))



6​
 

Attachments

  • Paint.jpg
    Paint.jpg
    37 KB · Views: 25
The count should be 9. The total of 1 & 2 together. From 3 to 10 there should be 1's in there. Somehow I now see 0's.
I'm asking a hypothetical scenario with the 0's. How many 1:2 combinations in this case?
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Maybe this.
Book1
BCDEFGHIJKLMNOPQRST
11234567891011
212172935199312111100
312131727299312111100
412132327333310000100
5123918411110000000
61252933522002001000
7125831611000110000
81232233711000110000
9126730
10123417
Sheet1
Cell Formulas
RangeFormula
J2:T8J2=SUM(--(BYROW($B$2:$F$10,LAMBDA(b,--(COUNTIFS(b,$I2)>0)+--(COUNTIFS(b,J$1)>0)))=2))
It appears as if this works. Just don't understand why the 1 to 1 has 9 instead of 0 as there wouldn't be any combinations of 1 & 1. If I am using the following cells in my formular how do I enter them using your formular: Looking in B2:F100 from K2 comparing to K1 & i2. If I was using the ranges B2 to F1000 how would the formular look?
 
Upvote 0
Maybe this.
Book1
BCDEFGHIJKLMNOPQRST
11234567891011
212172935199312111100
312131727299312111100
412132327333310000100
5123918411110000000
61252933522002001000
7125831611000110000
81232233711000110000
9126730
10123417
Sheet1
Cell Formulas
RangeFormula
J2:T8J2=SUM(--(BYROW($B$2:$F$10,LAMBDA(b,--(COUNTIFS(b,$I2)>0)+--(COUNTIFS(b,J$1)>0)))=2))
0
Maybe this.
Book1
BCDEFGHIJKLMNOPQRST
11234567891011
212172935199312111100
312131727299312111100
412132327333310000100
5123918411110000000
61252933522002001000
7125831611000110000
81232233711000110000
9126730
10123417
Sheet1
Cell Formulas
RangeFormula
J2:T8J2=SUM(--(BYROW($B$2:$F$10,LAMBDA(b,--(COUNTIFS(b,$I2)>0)+--(COUNTIFS(b,J$1)>0)))=2))
When I changed the first F10 to F100 it came back with 121. I checked it and it appears as if it was counting the number 2 from 25 and not treating 25 as one unit. Do you understand what I am saying?
 
Upvote 0
It appears as if this works. Just don't understand why the 1 to 1 has 9 instead of 0 as there wouldn't be any combinations of 1 & 1. If I am using the following cells in my formular how do I enter them using your formular: Looking in B2:F100 from K2 comparing to K1 & i2. If I was using the ranges B2 to F1000 how would the formular look?
I figured it out; it is counting every 1 including two digits containing the number 1. Not good.0
 
Upvote 0
This does not count 1:1 combos when there's no duplicate of that value in the same row.
Book1
BCDEFGHIJKLMNOPQRST
11234567891011
212172935109312111100
312131727290312111100
412132327333010000100
5123918411100000000
61252933522000001000
7125831611000010000
81232233711000100000
9126730
10123417
Sheet1
Cell Formulas
RangeFormula
J2:T8J2=SUM(--(BYROW($B$2:$F$10,LAMBDA(b,IF($I2=J$1,COUNTIFS(b,$I2)>1,(--(COUNTIFS(b,$I2)>0)+--(COUNTIFS(b,J$1)>0))>=2)))))
 
Upvote 0
It appears as if this works. Just don't understand why the 1 to 1 has 9 instead of 0 as there wouldn't be any combinations of 1 & 1. If I am using the following cells in my formular how do I enter them using your formular: Looking in B2:F100 from K2 comparing to K1 & i2. If I was using the ranges B2 to F1000 how would the formular look?
Post image of the layout.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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