SUMPRODUCT to calculate # of entries in a date range

virtuosok

Board Regular
Joined
Sep 2, 2020
Messages
209
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have the following 2 formulas which work well for my purpose:
Excel Formula:
=SUMPRODUCT((A4:A200="USA")*(G4:T200<DATE(2021,11,1)))
(this one returns 51)
Excel Formula:
=SUMPRODUCT((A4:A200="USA")*(G4:T200>DATE(2021,9,30)))
(this one returns 650)
...however, when I stitch them together to see how many hits for USA in Oct 21, the formula is not working as it should and it returns 650 (the result should be in low double digits)
Excel Formula:
=SUMPRODUCT((A4:A200="USA")*(G4:T200>DATE(2021,9,30)*(G4:T200<DATE(2021,11,1))))
What am I doing wrong please?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Parentheses in the wrong place

Try
=SUMPRODUCT((A4:A200="USA")*(G4:T200>DATE(2021,9,30))*(G4:T200<DATE(2021,11,1)))

M.
 
Upvote 0
Wow indeed, thanks a lot :)
Is there a way to embed a MONTH and YEAR function instead to make the formula shorter? i.e.
(--(MONTH($G$4:$T$300),0)=10)
(--(YEAR($G$4:$T$300),0)=2021)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,054
Latest member
juliecooper255

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