Attempting SUMIF across worksheets using INDIRECT and SUMPRODUCT

Rig88

New Member
Hi,

I'm trying to SUM cell J4 across a range of worksheets but only SUM if a static date, K4, on the worksheets are equals too or less than today's date. This is my current attempt at getting this formula to work;

=SUMPRODUCT(SUMIF(INDIRECT("'"&O7:O20&"'!K4"),"=<"&I3,INDIRECT("'"&O7:O20&"'!J4")))

I've listed my worksheet names in O7:O20 and I3 has "=TODAY()" in, on the same worksheet I'm trying to sum up these values. I should get a value of £1460.04 back from at least 1 of the cells if this formula was working correctly, but I'm getting a value of £0.00.

I'm currently using Window 7 and Office 2010.

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

jorismoerings

Well-known Member
Hi,

2 things to take into account:
1. change your formula to this: =SUMPRODUCT(SUMIF(INDIRECT("'"&O7:O20&"'!K4"),"<="&I3,INDIRECT("'"&O7:O20&"'!J4"))) - beware of the small change in the criteria definition.
2. your formula will return a #REF error if the sheets listed in the range O7:O20 will not exist.

Rig88

New Member
Hi,

2 things to take into account:
1. change your formula to this: =SUMPRODUCT(SUMIF(INDIRECT("'"&O7:O20&"'!K4"),"<="&I3,INDIRECT("'"&O7:O20&"'!J4"))) - beware of the small change in the criteria definition.
2. your formula will return a #REF error if the sheets listed in the range O7:O20 will not exist.

Oh my, I can't believe that is all it took to get this formula working, I feel a little bit of shame for overlooking something so simple.

Thank you very much for your time though, I really appreciate it.

jorismoerings

Well-known Member
Hi,

As usually "the devil is in the details".

Replies
3
Views
241
Replies
4
Views
294
Replies
40
Views
2K
Replies
1
Views
183
Replies
16
Views
367

1,181,546
Messages
5,930,531
Members
436,744
Latest member
Dhudson

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.

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

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