How to reverse the order in a SUMPRODUCT funktion???

VraGolan

New Member
Joined
Apr 23, 2019
Messages
4
I have the following example where I found the correct SUMPRODUCT formula but I would like to reverse the order i.e.:

[FONT=&quot]In column A I have different names, each of these names has a corresponding value in column B see example below:[/FONT]
[FONT=&quot]The following formula can look up any name entered in C1 (i.e X) and returns the sum of the last 3 X-Values.

[FONT=&quot]=SUMPRODUCT(B1:B9*(ROW(A1:A9)=LARGE(ROW(A1:A9)*(A1:A9="X"),{1,2,3})))[/FONT][/FONT]

[FONT=&quot]
In the below example for the last 3 X-values the total sum is 3.[/FONT]

[FONT=&quot]
PROBLEM: How can I reverse the order so that in stead of summing up the last three X-Values ( cells A9, A8 and A6) i get the sum of the first three X-values (i.e. values for cells A1, A4 and A6)???

Thank you for all comments and suggestions!


[/FONT]

ABCD
1
X2X3
2Y1
3Z1
4X2
5Z3
6X1
7Y2
8X1
9X1

<tbody>
</tbody>
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You must click (Ctrl+Shift+Enter) the end of line formula.

{=SUMPRODUCT(B1:B9*(ROW(A1:A9)=SMALL(IF(A1:A9="X",ROW(A1:A9),""),{1,2,3})))}
 
Upvote 0
@sadboy309 thanks a lot for your help!

My formula has changed a bit and I am trying to apply the same approach to the following formula but Can't get it to work.

=SUMPRODUCT(($C$4:$C$1000=L2)*(ROW($4:$1000)=LARGE(($C$4:$C$1000=L2)*ROW($4:$1000),{1,2,3}))*($I$4:$I$1000))

Do have any suggetion how this formula could be re-written?

Cheers.
 
Upvote 0
Maybe:

Code:
{=SUMPRODUCT(($C$4:$C$1000=L2)*(ROW($4:$1000)=SMALL(IF($C$4:$C$1000=L2,ROW($4:$1000),""),{1,2,3}))*($I$4:$I$1000))}
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,037
Members
449,062
Latest member
mike575

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