SUMPRODUCT formula revision

Lil Stinker

Board Regular
Joined
Feb 16, 2022
Messages
151
Office Version
  1. 2019
Platform
  1. Windows
Hello,
I am using the following SUMPRODUCT formula to count the number of dates that fall within a 14 day period.
=SUMPRODUCT((H2:H10000>=TODAY())*(H2:H10000<=TODAY()+14))

How do I alter this to count only the dates based on certain criteria in column C? For instance, in the data set example below, how do I count only the return dates where "*CP200*" shows or just the return dates where "*Charger*" is listed?
Book1.xlsm
ABCDEFGH
1Item IDSerialNumberModelDescriptionStatusLocationDateOutReturnDate
2476878Motorola Radius CP200UHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
36450654Motorola Radius CP200UHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
4657894Motorola Radius CP200UHF 16 Channel WalkieINWarehouse
5668183Motorola ChargerUHF 16 Channel WalkieINWarehouse
6679504Motorola ChargerUHF 16 Channel WalkieINWarehouse
7689545Motorola ChargerUHF 16 Channel WalkieINWarehouse
86910500Motorola Power SupplyUHF 16 Channel WalkieINWarehouse
97011050Motorola Radius CP200UHF 16 Channel WalkieINWarehouse
107112005Motorola Radius CP200UHF 16 Channel WalkieINWarehouse
117218456Motorola ChargerUHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
127325452Motorola Power SupplyUHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
137425453Motorola Power SupplyUHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
147565006Motorola Power SupplyUHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
157680000Motorola Radius CP200UHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
16775500Motorola Radius CP200UHF 16 Channel WalkieINWarehouse
17786500Motorola ChargerUHF 16 Channel WalkieINWarehouse
187994658Motorola ChargerUHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
198085858Motorola Radius CP200UHF 16 Channel WalkieOUTOC Carnival Event2/3/20232/13/2023
Sheet2
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Should be able to do this with COUNTIFS:
Excel Formula:
=COUNTIFS(H2:H10000,">=" & TODAY(),H2:H10000,"<=" & TODAY()+14,C2:C10000,"*CP200*")
and
Excel Formula:
=COUNTIFS(H2:H10000,">=" & TODAY(),H2:H10000,"<=" & TODAY()+14,C2:C10000,"*Charger*")
 
Upvote 0
Solution
Just in case you want to count if it has "*CP200*" or "*Charger*"

Excel Formula:
=SUM(COUNTIFS(H:H,">="&TODAY(),H:H,"<="&TODAY()+14,C:C,{"*CP200*","*Charger*"}))
 
Upvote 0
This is a sumproduct method:
Excel Formula:
=SUMPRODUCT(
(ISNUMBER(FIND("Charger",$C$2:$C$19))+ISNUMBER(FIND("CP200",$C$2:$C$19)))
*($H$2:$H$19<=$K$1)*($H$2:$H$19<=($K$1+14))*($H$2:$H$19<>"")
)
 
Upvote 0
This is a sumproduct method:
Excel Formula:
=SUMPRODUCT(
(ISNUMBER(FIND("Charger",$C$2:$C$19))+ISNUMBER(FIND("CP200",$C$2:$C$19)))
*($H$2:$H$19<=$K$1)*($H$2:$H$19<=($K$1+14))*($H$2:$H$19<>"")
)
Yeah, its a bit more complex using SUMPRODUCT that it is using COUNTIFS!
 
Upvote 0
OP started the question with SUMPRODUCT in mind, and specifically asked how to alter his SUMPRODUCT formula.
 
Upvote 0
@Lil Stinker , in the formula in post #4, I removed the TODAY() function and hard coded a date in K1 so you can get results. Using TODAY with your data gets a zero as of today.
 
Upvote 0
OP started the question with SUMPRODUCT in mind, and specifically asked how to alter his SUMPRODUCT formula.
Fair enough!

I find that many times people use a certain function because either someone else created it a long time ago and that is what they used, or they are unaware of other functions.
In older versions of Excel, there is COUNTIF but not COUNTIFS. So back then if you wanted to count multiple conditions, you had to use SUMPRODUCT.
But now that COUNTIFS exists, it is a little easier to use that instead! ;)

In any event, they now have multiple solutions to choose from!
 
Upvote 0
Should be able to do this with COUNTIFS:
Excel Formula:
=COUNTIFS(H2:H10000,">=" & TODAY(),H2:H10000,"<=" & TODAY()+14,C2:C10000,"*CP200*")
and
Excel Formula:
=COUNTIFS(H2:H10000,">=" & TODAY(),H2:H10000,"<=" & TODAY()+14,C2:C10000,"*Charger*")
@Joe4 Works like a charm! If I wanted to add farther date ranges, I could just change 14 to 30 or 60 or 90 days?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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