SUMPRODUCT with cell reference rather than text

Long Nose

Board Regular
Joined
Nov 19, 2007
Messages
67
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Can you help me turn this formula from an Array into Sumproduct?

Current working formula

{=SUM(IF(MONTH('3107'!$A$2:$A$188)=MONTH($A6),'3107'!F$2:F$188))+SUM(IF(MONTH('3207'!$A$2:$A$188)=MONTH($A6),'3207'!F$2:F$188))+SUM(IF(MONTH('4107'!$A$2:$A$188)=MONTH($A6),'4107'!F$2:F$188))+SUM(IF(MONTH('4207'!$A$2:$A$188)=MONTH($A6),'4207'!F$2:F$188))+SUM(IF(MONTH('4307'!$A$2:$A$188)=MONTH($A6),'4307'!F$2:F$188))+SUM(IF(MONTH('AS21'!$A$2:$A$188)=MONTH($A6),'AS21'!F$2:F$188))}

Failed to convert using

=SUMPRODUCT(--((IF(MONTH('3107'!$A$2:$A$188)=MONTH($A6),'3107'!F$2:F$188))+SUMPRODUCT(--(IF(MONTH('3207'!$A$2:$A$188)=MONTH($A6),'3207'!F$2:F$188))+SUMPRODUCT(--IF(MONTH('4107'!$A$2:$A$188)=MONTH($A6),'4107'!F$2:F$188))+SUMPRODUCT(--(IF(MONTH('4207'!$A$2:$A$188)=MONTH($A6),'4207'!F$2:F$188))+SUMPRODUCT(--((IF(MONTH('4307'!$A$2:$A$188)=MONTH($A6),'4307'!F$2:F$188))+SUMPRODUCT(--(IF(MONTH('AS21'!$A$2:$A$188)=MONTH($A6),'AS21'!F$2:F$188)))))))))

A6 is a month column and looks like this "Jan-08"
the '3107', '3207', '4107', etc. are the names of specific sheets, so I'm summing over multiple sheets.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try this:

=SUMPRODUCT(--(Month('3107'!$A$2:$A$188)=MONTH($A6)),'3107'!F$2:F$188)+SUMPRODUCT(--(MONTH('3207'!$A$2:$A$188)=MONTH($A6)),'3207'!F$2:F$188)+SUMPRODUCT(--(MONTH('4107'!$A$2:$A$188)=MONTH($A6)),'4107'!F$2:F$188)etc.....keep going you just need one ")" at the end
 
Upvote 0
You could create on every relevant sheet an additional column, say, G, with"

=MONTH(A2)

Then invoke:

=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!G2:G188"),MONTH($A6),INDIRECT("'"&SheetList&"'!F2:F188")))

where SheetList refers to a range housing the relevant sheet names, that is, 3107, 3207, etc.
 
Upvote 0
angiemeh, that does fix the problem, thanks!

Aladin, would this "sheetlist" fix the problem of "formula is too long"? Right now I have to add up three different formulas because I have too many arguments.

I'm not sure I understand all the steps in your solution.
 
Upvote 0
angiemeh, that does fix the problem, thanks!

Aladin, would this "sheetlist" fix the problem of "formula is too long"? Right now I have to add up three different formulas because I have too many arguments.

I'm not sure I understand all the steps in your solution.

If all the sheets have the same lay-out, then the answer is yes. I'd suggest to re-read my post for the steps you need to take.
 
Upvote 0
If all the sheets have the same lay-out, then the answer is yes. I'd suggest to re-read my post for the steps you need to take.

Aladin, Thanks for your response. I am interested in learning about this sheetlist and column G.

But, I'm failing to understand what is in the new "G" column and MONTH(A2). Can you explain a little more?
 
Upvote 0
Wow. Aladin, It worked. This is way cool!

Thanks!
 
Upvote 0
You could create on every relevant sheet an additional column, say, G, with"

=MONTH(A2)

Then invoke:

=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!G2:G188"),MONTH($A6),INDIRECT("'"&SheetList&"'!F2:F188")))

where SheetList refers to a range housing the relevant sheet names, that is, 3107, 3207, etc.

Aladin,

If I wanted to add one more criteria to this formula like MONTH($A6) and ="DDD" in column H, how is this done? My other multi-criteria formulas use the ,-- to add, but I'm stumped on this one.

Thanks a shed-load
 
Upvote 0
What is "DDD"? I'm not 100% clear what you are trying to do.
I'll give it a shot:
Let's say you wanted to meet the criteria of both month and day. You could have your month formula in Column G. =Month(cell) then you could have a concatenated Month AND Day formula in column H

You could have a formula that concatenates the two- but put a "-" between them, so you could say =concatenate(Month(A6),"-",Day(A6))

You could replace column G with this formula if you just wanted to sum up items that only met both the day and month. If you want to do both: sum of all items that = month AND you also wanted a sum of items that = month AND Day, then put the formula in column H and copy all the way down. Then with Aladin's formula you would just use H2:H188 instead of G

I may not understand what you are asking... so if this doesn't work, please clarify.
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,381
Members
448,888
Latest member
Arle8907

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