SUMPRODUCT formula that adjusts the bottom of the range but maintains the top of the range

jeffmoseler

Well-known Member
Joined
Jul 16, 2004
Messages
539
I have the following formula in a cell:

=SUMPRODUCT(--(MONTH(Prospects!$AO$12:$AO12)=B1),--(YEAR(Prospects!$AO$12:$AO12)=$A$8),Prospects!$AQ$12:$AQ12)

When I add a row at line 12, it changes the formula to read:

=SUMPRODUCT(--(MONTH(Prospects!$AO$13:$AO13)=B1),--(YEAR(Prospects!$AO$13:$AO13)=$A$8),Prospects!$AQ$13:$AQ13)

How do I write this so that Row 12 stays at 12 and the bottom row grows as I add them. So it should read:

=SUMPRODUCT(--(MONTH(Prospects!$AO$12:$AO13)=B1),--(YEAR(Prospects!$AO$12:$AO13)=$A$8),Prospects!$AQ$12:$AQ13)
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi Mose

Just changing the syntax of your formula, try:

=SUMPRODUCT(--(MONTH(INDEX(Prospects!$AO:$AO,12):Prospects!$AO13)=B1),--(YEAR(INDEX(Prospects!$AO:$AO,12):Prospects!$AO13)=$A$8),INDEX(Prospects!$AQ:$AQ,12):Prospects!$AQ13)
 

jeffmoseler

Well-known Member
Joined
Jul 16, 2004
Messages
539
Thanks! Worked great! I knew there was a way to incorporate the INDEX function but I couldn't wrap my head around how to do it.
 

jeffmoseler

Well-known Member
Joined
Jul 16, 2004
Messages
539
This worked great, so I would like to reopen it to ask another question. I would like to apply the same formula to calculate another metric. It needs to have one more condition than the previous one. I thought I could figure it out but once again it is stumping me. Here is what I have:

{=SUMPRODUCT(--((INDEX(Completed!$AS:$AS,2):Completed!$AS6)="Sold"), --(MONTH(INDEX(Completed!$AO:$AO,2):Completed!$AO6)=B1),--(YEAR(INDEX(Completed!$AO:$AO,2):Completed!$AO6)=$A$8),INDEX(Completed!$AQ:$AQ,2):Completed!$AQ6)}

I added the "Sold" condition for another column. It's showing a result of $0 even though the result should be $2,241.30

Can someone evaluate this and let me know if I am writing something incorrectly?
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi

I don't see anything wrong with the formula.

I would debug it evaluating the conditions one by one to see which is not working.

For ex., the condition you added:

=SUMPRODUCT(--((INDEX(Completed!$AS:$AS,2):Completed!$AS6)="Sold"))

Does this work how you expect?
 

Watch MrExcel Video

Forum statistics

Threads
1,123,271
Messages
5,600,651
Members
414,399
Latest member
Ninjee

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
Top