2-D / Matrix usage of COUNTIFS or SUMPRODUCT(ISNUMBER(SEARCH()))

dmessmer

New Member
Joined
Mar 27, 2017
Messages
6
Hello,

1st time poster here. I am trying to create a countif or a sumproduct which: 1) recognizes which column it needs to count from, and then counts based upon if the entry in that column meets another criteria. So in this example, cell B3 would look at all of Row 1, find 'Tom' in Column E, and then return a Count from that Column where E:E = D:D. So since E2 = D2, E3 = D3, and E4 = D4, it returns a count of 3. But for B4 ('Jack'), it only returns a count of 1 because Column G only contains 1 worthy instance (where G2 = D2).

I should also note that in the example everything is on the same worksheet. But in practicality Columns A & B are on Worksheet 1 and Columns D-H are on Worksheet 2. However I assume the underlying logic would still be the same? If possible, I would like to avoid using array formulas.

ABCDEFGH
1PersonCount of Matching FruitFruit to MatchTomBobJackJill
2Tom3AppleAppleGrapeAppleGrape
3Bob2OrangeOrangeOrangeKiwiOrange
4Jack1PearPearPearWatermelonPear
5Jill2

<tbody>
</tbody>
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Welcome to the forum.

Try:

ABCDEFGH
1PersonCount of Matching FruitFruit to MatchTomBobJackJill
2Tom3AppleAppleGrapeAppleGrape
3Bob2OrangeOrangeOrangeKiwiOrange
4Jack1PearPearPearWatermelonPear
5Jill2

<tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
B2=SUMPRODUCT(--($D$2:$D$10=OFFSET($D$2:$D$10,0,MATCH(A2,$E$1:$K$1,0))),--($D$2:$D$10<>""))

<tbody>
</tbody>

<tbody>
</tbody>

Since your tables will be on different sheets, you'll need to adjust the ranges, and the MATCH may require an offset.
 
Last edited:
Upvote 0
Heres a way:

=SUMPRODUCT(--(INDEX($E$2:$H$4,,MATCH(A2,$E$1:$H$1,0))=$D$2:$D$4))
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,478
Members
448,967
Latest member
visheshkotha

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