ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Need formula for cumulative data-using prior worksheet (YTD) (https://www.excelbanter.com/excel-discussion-misc-queries/24185-need-formula-cumulative-data-using-prior-worksheet-ytd.html)

travchev

Need formula for cumulative data-using prior worksheet (YTD)
 
I am looking for the function to use to be able to calculate data using the
prior worksheet, vs an absolute function using the same sheet.

Chip Pearson

Excel doesn't support relative sheet referencing; that is, you
can't write a formula like

=PreviousSheet!A1

You'll either have to hard code the previous sheet's name, or use
VBA to get the name of the previous sheet and incorporate that in
to an INDIRECT function. E.g.,

Function PreviousSheet() As String
PreviousSheet = Application.Caller.Parent.Previous.Next.Name
End Function

=INDIRECT(PreviousSheet & "!A1")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"travchev" wrote in message
...
I am looking for the function to use to be able to calculate
data using the
prior worksheet, vs an absolute function using the same sheet.





All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com