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>
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

sadboy309

Board Regular
Joined
Oct 15, 2014
Messages
88
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})))}
 

VraGolan

New Member
Joined
Apr 23, 2019
Messages
4
@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.
 

sadboy309

Board Regular
Joined
Oct 15, 2014
Messages
88
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))}
 

Watch MrExcel Video

Forum statistics

Threads
1,123,312
Messages
5,600,887
Members
414,414
Latest member
neil_c

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