finding last row of data

kemperohlmeyer

Board Regular
Joined
Oct 4, 2006
Messages
73
What is the formula to tell excel to look for the last row of data (i.e. return data of stocks) and then use that as a reference point to calculate from?

ie, find last data point and use the previous three data points from there to calculate a qtr's return?

ko
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
This:

=INDEX(A:A,MATCH(9.99999999999999E+307,A:A))

will return a reference to the last non-empty cell in column A, assuming it contains numbers, and:

=SUM(OFFSET(INDEX(A:A,MATCH(9.99999999999999E+307,A:A)),-2,0,3,1))

will sum the last 3 entries.

In VBA this:

Code:
Dim Rng As Range
Set Rng = Range("A" & Rows.Count).End(xlUp)

will create a Range object that refers to the last non-empty cell in column A on the ActiveSheet.
 

Forum statistics

Threads
1,136,575
Messages
5,676,645
Members
419,637
Latest member
jwazza343

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