Is there a better way tro reference a different row in a table?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,687
Office Version
  1. 365
Platform
  1. Windows
Columns J & K in this table need to reference the cell in the row above the one making the reference. This is the code that Excel generated. It seems to work, but the cell references do not look like the other table expressions. I would think this would come up all the time as in my example for calculating cumulative values. But I couldn't find anything in the Excel help about it. Is there another, better way to do this?

Wages by Profession.xlsx
GHIJK
3#TopRateWidthCum Tax
40$00.00%--$0
51$10,00010.00%$10,000$1,000
62$40,00012.00%$30,000$4,600
73$86,00022.00%$46,000$14,720
84$165,00024.00%$79,000$33,680
95$209,00032.00%$44,000$47,760
106$524,00035.00%$315,000$158,010
117--37.00%--
Tax Brackets
Cell Formulas
RangeFormula
J5:J10J5=[@Top]-H4
K5:K10K5=K4+[@Width]*[@Rate]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
What about for
J5:
Excel Formula:
=[@Top]-OFFSET([@Top],-1,0)
K5:
Excel Formula:
=OFFSET([@[Cum Tax]],-1,0)+[@Width]*[@Rate]
 
Upvote 0
Solution
What about for
J5:
Excel Formula:
=[@Top]-OFFSET([@Top],-1,0)
K5:
Excel Formula:
=OFFSET([@[Cum Tax]],-1,0)+[@Width]*[@Rate]

That's what I used to do before you guys turned me onto tables. Now I can't live without 'em. ??

I was hoping that M$FT had built in a better offset syntax. (sigh) But then, I've been wanting a better offset syntax for all of Excel, something like,
Code:
=[@Top]-[@Top](-1,0)
=[@[Cum Tax]](-1,0)+[@Width]*[@Rate]

The offset syntax should be built into the language, not cobbled on afterwards with the Offset function. ?

Thanks
 
Upvote 0
I was hoping that M$FT had built in a better offset syntax. (sigh) But then, I've been wanting a better offset syntax for all of Excel, something like,
Code:
=[@Top]-[@Top](-1,0)
=[@[Cum Tax]](-1,0)+[@Width]*[@Rate]
The offset syntax should be built into the language, not cobbled on afterwards with the Offset function. ?
On the contrary, from my point of view, I think there is great merit in consistency. Excel has (I think) nearly 500 functions. Why would you have/want one out of that list that did not use its actual name?
And why the less used and volatile OFFSET function and not, say, the much more commonly used INDEX function?
 
Upvote 0
On the contrary, from my point of view, I think there is great merit in consistency. Excel has (I think) nearly 500 functions. Why would you have/want one out of that list that did not use its actual name?
I also think there is great merit in consistency, but I don't know what that has to do with this.

Excel has lots of notation "shortcuts". Using your point of view, we should replace all but the basic math operators with functions. A couple of examples:

We already have the implicit intersection operator (@). Let's replace that with an explicit function (Intersect?). Now instead of the compact, but implicit =@rangename, we could have the more explicit, but less compact =Intersect(rangename).

The $ sign controls whether a reference is relative or absolute. Why not replace that with four functions? Instead of the very compact and easy to read =$A$1, we could have the much more awkward =AbsAbs(A1). Instead of =A$1, we would get =RelAbs(A1).

And why the less used and volatile OFFSET function and not, say, the much more commonly used INDEX function?
If someone can come up with a nice clean, clear notation, I would vote to replace Index. That one is so complicated and variable that a function is probably warranted. At least, I cannot immediately see a reasonable notational replacement.

If you are referring to to my application, I don't see how Index is relevant. I need a reference relative to a specific cell, not an intersection. But I assume you are not since you suggested Offset, not Index.

I use Offset all the time, much more than Index, because I have a lot of situations where I am calculating some type of cumulative value.
And I hate it every time. I long for a simple notation that will allow me to access the cell just above another cell.

ymmv
 
Upvote 0
The offset syntax should be built into the language, not cobbled on afterwards with the Offset function
IME it is quite rare to want to refer to a cell strictly by its relation to a cell that is not the cell with the formula in.

Structured referencing, unlike normal formula syntax, is severely lacking in its implementation (but then I find tables annoying for anything other than reference/source data for other things) and I tend to avoid it in tables whenever possible.
 
Upvote 0
IME it is quite rare to want to refer to a cell strictly by its relation to a cell that is not the cell with the formula in.
Hmmm... I guess I a quite rare individual as I do it all the time.

How would you do the table in my original post without the Offset function?

Structured referencing, unlike normal formula syntax, is severely lacking in its implementation (but then I find tables annoying for anything other than reference/source data for other things) and I tend to avoid it in tables whenever possible.
Not sure I understand this point. What specifically is lacking in the structured reference syntax that is not lacking in the normal formula syntax? By "structured reference", I assume you mean references to cells within a table.
 
Upvote 0
What specifically is lacking in the structured reference syntax that is not lacking in the normal formula syntax
The thing you asked for. There is no direct way of saying 'the cell above the current row' in structured referencing. In normal syntax you just say C24 rather than C25 for example. If you view that in R1C1 format it equates to something like 'the cell one row up and three columns to the left' There's also no simple way of locking a column or row reference - you have to use the 'double column name in square brackets' syntax which I find somewhat ridiculous.

How would you do the table in my original post without the Offset function?

I'd use a normal cell reference.
 
Upvote 0
The thing you asked for. There is no direct way of saying 'the cell above the current row' in structured referencing. In normal syntax you just say C24 rather than C25 for example. If you view that in R1C1 format it equates to something like 'the cell one row up and three columns to the left' There's also no simple way of locking a column or row reference - you have to use the 'double column name in square brackets' syntax which I find somewhat ridiculous.
Unless I'm missing something, there is also no way of saying 'the cell above the current row' in normal syntax. If I just say C24 from C25, it is not absolutely tied to C25. That is, it is not absolutely the same as Offset(C24,-1,0). If I move that row (24), most of the time the C24 adjusts. But I have had problems with it not adjusting so I always use Offset.

I'd use a normal cell reference.
I have had problems with that in the past.
 
Upvote 0
Excel has lots of notation "shortcuts". Using your point of view, we should replace all but the basic math operators with functions. A couple of examples:

We already have the implicit intersection operator (@). Let's replace that with an explicit function (Intersect?). Now instead of the compact, but implicit =@rangename, we could have the more explicit, but less compact =Intersect(rangename).

The $ sign controls whether a reference is relative or absolute. Why not replace that with four functions? Instead of the very compact and easy to read =$A$1, we could have the much more awkward =AbsAbs(A1). Instead of =A$1, we would get =RelAbs(A1).
Not at all. My point was about functions, not operators or other notations.
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,827
Members
452,673
Latest member
LaMiaAvy

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