Sum the last n values in a row based on a criteria.

MindTheGap

New Member
Joined
Feb 23, 2016
Messages
6
Hello.

I have Column A and Column B and I am looking to get the sum of the last 3 values from column B given they match the name in A. The formula I am currently using returns the sum of the last 3 values of B but when I try and put that formula in a SUMIFS function to test for matching the name in column A it doesn't work.

Thank you in advance.

3FCpbI4.png
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

This?


A
B
C
1
name​
value​
2
A​
1​
3
B​
1​
4
B​
9​
5
B​
2​
6
A​
-5​
7
A​
3​
8
A​
2​
9
C​
15​
10
C​
68​
11
C​
9​
12
C​
1​
78​
13
D​
5​
5​
14
A​
5​
10​
15
B​
7​
18​

Formula in B12 copied down
=SUMPRODUCT(--(ROW(A$2:A12)>=LARGE((A$2:$A12=A12)*ROW(A$2:$A12),3)),--(A$2:A12=A12),B$2:B12)

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,215,564
Messages
6,125,575
Members
449,237
Latest member
Chase S

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