Link to home
Start Free TrialLog in
Avatar of Jenedge73
Jenedge73Flag for Afghanistan

asked on

Referencing 1st preceding sheet in excel

Is there a way I can reference a cell in the preceding sheet of a workbook so that when I  copy that worksheet to the end of the workbook the reference will hold to the next last sheet. I would like to use a function, however if I have to I could use a macro
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

As there is already a solution for this, I assume it's not possible in a formula.

See: http://j-walk.com/ss/excel/tips/tip63.htm 

Of course you could change this to always use an offset of -1 and maybe other defaults you want to use like look at the same cell in that sheet.

If you need help implementing that, let me know.
I have made an example, hope that's clearer, if needed.
Test.xls
Avatar of Jenedge73

ASKER

Could i use an indirect function and change the sheet name to reflect ie a 1 week difference based on let's say a 52 week year?
is this what you mean:

=INDIRECT(ADDRESS(ROW(),COLUMN(),,,"week"&(WEEKNUM(DATEVALUE("2012-03-20"))-1)))

Open in new window


This references the current cell in the "week11" sheet, since weeknum for today is 12.

The literal date can be replaced by a cell ref, or a call to TODAY() if that's what you need.
It can apparently also be done with a formula that gets the full reference to a cell, for example in cell A25 I've put:

=CELL("filename",A1)

Open in new window


Then in A26:

=MID(A25,FIND("]",A25)+1,LEN(A25)-FIND("]",A25))

Open in new window


This gets the sheet name which in this case was: week12

Then in cell A27:

=LEFT(A26,4)&INT(MID(A26,5,LEN(A26)-4))-1

Open in new window


That returns the previous week, so now you can use that cell as the 5th argument to the ADDRESS call. Maybe that's more applicable to your situation? It's a pain with the extra cells though, you could write each reference out of course but it might become painfully slow, I don't really know.
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks