Sum the last 10 entries in a dynamic range

rozak

New Member
Joined
Nov 24, 2016
Messages
8
Syntax: Find the last entry in col C, then sum that plus the 9 entries above it.

=SUM(LOOKUP(2,1/(C:C<>""),C:C):OFFSET(LOOKUP(2,1/(C:C<>""),C:C),-9,,,))

Separately, the LOOKUP function works fine, but returns an error when used with OFFSET (in this case anyway).
Thanks
 

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"

Matt Rogers

Well-known Member
Joined
Sep 23, 2011
Messages
1,030
Hi.

The last 5 rows only !!!
Excel Workbook
CDE
11*500
21**
31**
41**
51**
61**
71**
8100**
9100**
10100**
11100**
12100**
13***
Sheet
 
Last edited:
Upvote 0

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,029
The simplest formula, IMO, is below. It assumes the data are in column M starting with M1.

Code:
=SUM(OFFSET(M1,COUNT(M:M)-1-(10-1),0,10))
An alternative, if one prefers INDEX to OFFSET is
Code:
=SUM(INDEX(M:M,COUNT(M:M)-(10-1)):INDEX(M:M,COUNT(M:M)))
The 2 references to 10 are to the number of elements you want to include in the SUM.
Syntax: Find the last entry in col C, then sum that plus the 9 entries above it.

=SUM(LOOKUP(2,1/(C:C<>""),C:C):OFFSET(LOOKUP(2,1/(C:C<>""),C:C),-9,,,))

Separately, the LOOKUP function works fine, but returns an error when used with OFFSET (in this case anyway).
Thanks
 
Upvote 0

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
Here's another one.

Assumes there will always be at least 10 numbers to sum and the data is in a contiguous range.

=SUM(OFFSET(C1,MATCH(1E100,C:C)-1,0,-10))
 
Upvote 0

Forum statistics

Threads
1,190,646
Messages
5,982,113
Members
439,755
Latest member
nicos18

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