Sumproduct returning wrong result

Deutz

Board Regular
Joined
Nov 30, 2009
Messages
199
Office Version
  1. 365
Platform
  1. Windows
Hi and thanks in advance,

I am trying to return a count of rows containing dates by month.

As per the image below, I am using the following formula to get the counts in column C ...

=SUMPRODUCT(1*(MONTH('QA Dashboard'!$I$4:$I$120)=A19))

(where column A has the appropriate month number)

All months except January are returning the correct count. The date range on another sheet contains 117 cells and January is picking up all the cells that contain blanks for some reason. I have deleted all values from the date columm, reinput the dates but keep getting the same result.

Kind regards
Deutz
 

Attachments

  • Sumproduct.png
    Sumproduct.png
    11.2 KB · Views: 6

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Blank cells are stored as 1/0/1900 so MONTH will return 1. You'd need another condition to filter out the blanks. Try:
Excel Formula:
=SUMPRODUCT(('QA Dashboard'!$I$4:$I$120<>"")*(MONTH('QA Dashboard'!$I$4:$I$120)=A19))
 
Upvote 0
Solution
Blank cells are stored as 1/0/1900 so MONTH will return 1. You'd need another condition to filter out the blanks. Try:
Excel Formula:
=SUMPRODUCT(('QA Dashboard'!$I$4:$I$120<>"")*(MONTH('QA Dashboard'!$I$4:$I$120)=A19))
Thanks Cubist, that makes sense.

I have tested your solution and it works. Thanks ... much appreciated!
 
Upvote 0
You're welcome.
Side note: with newer version, you can simply use SUM instead of SUMPRODUCT.
 
Upvote 0
Your range in QA Dashboard is not very big so this will likely not be an issue for you but SUMPRODUCT is not a very efficient function. You may not have it yet but if you do (or when you do get it) then you can use the GROUPBY function instead. As well as eliminating the SUMPRODUCT function, this also only requires this formula in the top cell and does not need to be copied down.
I have included the previous formula in column C so that you can see that the results are the same.

At least this function might be something to keep in mind for the future even if you choose not to use it here.

Deutz.xlsm
ABCD
13744
14844
15922
161055
171111
181211
19177
20211
21333
22400
23522
24622
Sheet1
Cell Formulas
RangeFormula
C13:C24C13=LET(d,'QA Dashboard'!I4:I120,IFNA(VLOOKUP(A13:A24,GROUPBY(MONTH(d),d,COUNT),2,0),0))
D13:D24D13=SUMPRODUCT(('QA Dashboard'!$I$4:$I$120<>"")*(MONTH('QA Dashboard'!$I$4:$I$120)=A13))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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