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]

[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Y[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Z[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Z[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Y[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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