![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I often upgrade the readability of formulas by naming a column (technically as a range) and replacing e.g. =D2 by =Status relying on Excel interpreting the range name as a reference to the current row in that range. (Sad though that formula editing's source highlighting doesn't do the same, instead showing highlighting range rather than cell.)
However, replacing =myfunc(D2) by =myfunc(Status) can (depending on myfunc definition) fail with a VALUE error. It seems the interpretation is AWOL. My workaround is: =myfunc(INDEX(Status,ROW())) . This defeats much of the readability upgrade. Do you know a workaround that's more readable? The best I've come up with is a user function - here(<name>) - which is a lot more elaborate in definition and a lot slower in execution. |
#2
|
|||
|
|||
![]()
Instead regular table, use Defined Table (Insert>Table)
Then, in case the formula will be in same table, you can refer to cell in same row, like =[@Status] (where Status is the example name for header of referred column) In case the formula will not be in same table, you can refer to cell of any Defined Table in same row as the current row for your formula, like =tTest[@Status] where tTest is the example of name of Defined Table You also can refer to whole column of Defined Table, like =COUNTA(tTest[Status]) Or to column header of Defined Table, like =tTest[[#Headers];[Status]] etc. |
#3
|
|||
|
|||
![]()
Excel 2003, so I tried Data > List.
Quote:
![]() |
#4
|
|||
|
|||
![]()
Sorry! Defined Tables are available starting from Excel 2007!
A possible workaround for older versions: Add to table a column where the row number of table's datarange is calculated, like =ROW() - HeaderRowNumber (In case the start row if datarange is always fixed, you can skip this part, and simply calculate the datarange row number whenever it is needed); Define dataranges of table columns you need to refer to in your formulas as dynamic names. Like the datarange where row numbers mentioned above are calculated. P.e. the row numbers are calculated in column F, and the header row of table is 1, then the formula for named range nRow will be something like Code:
=OFFSET($F$1,1,,MAX($F:$F),1) To get a value from cell in current row of datarange defined e.g. as nTest in same table, use formula (e.g. in row 2 of your worksheet) like Code:
=INDEX(nTest,$F2) |
#5
|
|||
|
|||
![]()
I'm not sure $F2 is more readable than ROW(), but thanks very much since I think you've demonstrated no improvement is possible beyond the here() function.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unable to see names in merge since upgrading to Word 2016 | thelighthouse | Mail Merge | 2 | 06-21-2017 06:55 AM |
Convert cell with formula to literal value | JoyLearner | Excel | 5 | 05-31-2017 09:30 AM |
Do I stand to gain productivity overall by upgrading to Word 2007/2010 from 2003? | New Daddy | Word | 3 | 11-27-2012 03:24 PM |
![]() |
reuven1925 | Office | 1 | 09-01-2011 05:28 AM |
![]() |
Ckingfly | Office | 2 | 01-09-2011 03:27 PM |