Problem with SUMPRODUCT formula

Sean15

Well-known Member
Joined
Jun 25, 2005
Messages
698
Office Version
  1. 2010
Platform
  1. Windows
Hi:

The formula below gives all required values:
=SUMPRODUCT(--(PostingDate>=$I$2),--(PostingDate<=$K$2),--(TransactionCategory=C36),Amount)

where:
I2 = 9/15/23
K2 = 01/05/24

I adapted formula to return values up to end of month (K2)
=SUMPRODUCT(--(PostingDate>=$I$2),--(PostingDate<=EOMONTH($K$2,0),--(TransactionCategory=C36),Amount)

but Excel returned invalid formula. Could you advise a fix please?

Regards,
S
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You are missing a 2nd bracket after the EOMonth function .
Also if you swap the separating commas for multiplication you don't need all the double unaries ("--")

Excel Formula:
=SUMPRODUCT((PostingDate>=$I$2)*(PostingDate<=EOMONTH($K$2,0))*(TransactionCategory=C36)*Amount)
 
Upvote 0
Thank you.
I added missing bracket. Formula with double unaries ("--") returned required value.
I also tested formula without double unaries but Excel returned #VALUE.



The required value is -1,186.70. It's unclear why #VALUE appears in formula evaluation.

Regards,
S
 
Upvote 0
Glad to hear your formula is working for you now.
In relation to using multiply, you would need to copy paste in here the exact formula you tried. I can't replicate the error you are getting. Do you definitely have $K$2 in the modified formula with the valid date in the cell ?
 
Upvote 0
Hi:
Formula tried:



Tested value in I2 and K2 for date using =Value()
Value(I2)=45184
Value(K2)=45296
 
Upvote 0
That looks fine to me. If the double unary works then that should work.
If you can give me some data that it fails on via XL2BB or via a link to a shared workbook I can have a look from my end.
The most likely to produce a Value error is the EOMonth function, so as a proof on concept you could remove that function just to see if we can the "*" to work in principle.
 
Upvote 0

Forum statistics

Threads
1,215,098
Messages
6,123,082
Members
449,094
Latest member
mystic19

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