Replacing Countifs with Sumproduct?

Mr_Phil

Board Regular
Joined
May 28, 2018
Messages
150
Office Version
  1. 365
Can someone help me with replacing a Countifs with Sumproduct.
I did an XLOOKUP successfully but it brings back the serial number and won't catch anyone with more than one. So that isn't viable.
The issue is that the Countifs requires the external data source to be open. That was fine for a while. But, now I need to be able to quickly reference the data without opening multiple workbooks. And based on some googling the sumproducts is the way to go. But I am having trouble visualizing how t construct it.

Code:
=COUNTIFS('[Pull Sheet.xlsb]FIELD OH'!$I:$I,$A2,'[Pull Sheet.xlsb]FIELD OH'!$A:$A,$B$1)
is the formula I am trying to replace. The absolute references were removed once it was copied to all the cells in a range.

Thank you for looking. I hope everyone is well.



And if you ever need an xlookup that uses concantentation ... here it is. I was pretty proud to have figured it out without having to google or anything. To bad the result isn't a count of lines matching the criteria.
Code:
=XLOOKUP($A2&$B$1,'[Pull Sheet.xlsb]FIELD OH'!$I:$I&'[Pull Sheet.xlsb]FIELD OH'!$A:$A,'[Pull Sheet.xlsb]FIELD OH'!$B:$B)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
See if this works for you.
Excel Formula:
=LET(fltr,  FILTER('[Pull Sheet.xlsb]FIELD OH'!$I:$I,  ('[Pull Sheet.xlsb]FIELD OH'!$I:$I=$A2) * ('[Pull Sheet.xlsb]FIELD OH'!$A:$A=$B$1) ),
          SUM(--NOT( ISERROR(fltr) ) ) )
 
Upvote 0
Another option
Excel Formula:
=COUNT(FILTER(ROW('[Pull Sheet.xlsb]FIELD OH'!$I$2:$I$1000),('[Pull Sheet.xlsb]FIELD OH'!$I$2:$I$1000=$A2)*('[Pull Sheet.xlsb]FIELD OH'!$A$2:$A$1000=$B$1)))
 
Upvote 0
=SUMPRODUCT(--('[Pull Sheet.xlsb]FIELD OH'!$I:$I=$A2)*('[Pull Sheet.xlsb]FIELD OH'!$A:$A=$B$1))
 
Upvote 0
Solution
See if this works for you.
Excel Formula:
=LET(fltr,  FILTER('[Pull Sheet.xlsb]FIELD OH'!$I:$I,  ('[Pull Sheet.xlsb]FIELD OH'!$I:$I=$A2) * ('[Pull Sheet.xlsb]FIELD OH'!$A:$A=$B$1) ),
          SUM(--NOT( ISERROR(fltr) ) ) )

Another option
Excel Formula:
=COUNT(FILTER(ROW('[Pull Sheet.xlsb]FIELD OH'!$I$2:$I$1000),('[Pull Sheet.xlsb]FIELD OH'!$I$2:$I$1000=$A2)*('[Pull Sheet.xlsb]FIELD OH'!$A$2:$A$1000=$B$1)))

=SUMPRODUCT(--('[Pull Sheet.xlsb]FIELD OH'!$I:$I=$A2)*('[Pull Sheet.xlsb]FIELD OH'!$A:$A=$B$1))

First I need to thank each of you for taking the time to help me. I tried all three solutions and all three worked. I chose the sumproduct solution because I have never used any of the gifted options and I think I will be able to study and understand the syntax and what is going on quicker than the others. But, don't be surprised to get a notification of a message here properly thanking each of you as I dig in and understand the details of all three options. Y'all are the best. Thank you.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,510
Members
452,918
Latest member
Davion615

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