Wasn't meant to offend...just commented that the style (i.e.using all those Named Formulas is what I often see Domenic solutions consist of) ... that's all
Wasn't meant to offend...just commented that the style (i.e.using all those Named Formulas is what I often see Domenic solutions consist of) ... that's all
Where there is a will there are many ways.
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
OK, here's my tortured approach, similar to DO/Domenic's.
Suppose we have a table of variable-length data starting with headers starting in D:F with a header in row 6. We want definitions that ensure that adding data to the table (top, bottom, or in between) extends all ranges appropriately to include it, and allows moving the table without hosing the ranges.
Define:
ptrTL Refers to: =$D$6
rgnHdrDown Refers to: =ptrTL:$F$65536
frmEnd Refers to: (any method appropriate to table contents; sometimes I just use the word End if I really want to have other data below the table)
This defines everything from the header row downward. The actual data starts one row below that, so we define:
tbl Refers to: =INDEX(rgnHdrDown, 2, 0):INDEX(rgnHdrDown, frmEnd, 0)
This makes the table start one row below the header, and extend to the last row.
Suppose the table contains values for x, y, z in columns D:F respectively. Then define
ptrX Refers to: =$D$6
ptrY Refers to: =$E$6
ptrZ Refers to: =$F$6
rgnX Refers to: =INDEX(tbl, 0, COLUMNS(ptrTL:ptrX) )
rgnY Refers to: =INDEX(tbl, 0, COLUMNS(ptrTL:ptrY) )
rgnX Refers to: =INDEX(tbl, 0, COLUMNS(ptrTL:ptrZ) )
This seems a little awkward, but it defines the columns in terms of the offsets from the start of the table to their named header cells.
The approach allows rows to be inserted above, and columns to be inserted to the left or the interior of the table, with ranges adjusting automatically.
Suppose you want to apply a function (say, SUM) to a particular column. Use this formula in the same column, anywhere above the data:
=SUM(INDEX(tbl, 0, COLUMNS(ptrTL:Me))
Last edited by shg; 02-11-2009 at 02:02 PM.
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks