Excel Reference To Current Cell
Several years too late:
Just for completeness I want to give yet another answer:
First, go to Excel-Options -> Formulas and enable R1C1 references. Then use
=CELL("width", RC)
RC
always refers the current Row, current Column, i.e. "this cell".
Rick Teachey's solution is basically a tweak to make the same possible in A1 reference style (see also GSerg's comment to Joey's answer and note his comment to Patrick McDonald's answer).
Cheers
:-)
Create a named formula called THIS_CELL
In the current worksheet, select cell A1 (this is important!)
Open
Name Manager
(Ctl+F3)Click
New...
Enter "THIS_CELL" (or just "THIS", which is my preference) into
Name:
Enter the following formula into
Refers to:
=!A1
NOTE: Be sure cell A1 is selected. This formula is relative to the ActiveCell.
Under
Scope:
selectWorkbook
.Click
OK
and close theName Manager
Use the formula in the worksheet exactly as you wanted
=CELL("width",THIS_CELL)
EDIT: Better solution than using INDIRECT()
It's worth noting that the solution I've given should be preferred over any solution using the INDIRECT()
function for two reasons:
- It is nonvolatile, while
INDIRECT()
is a volatile Excel function, and as a result will dramatically slow down workbook calculation when it is used a lot. - It is much simpler, and does not require converting an address (in the form of
ROW()
COLUMN()
) to a range reference to an address and back to a range reference again.
EDIT: Also see this question for more information on workbook-scoped, sheet dependent named ranges.
EDIT: Also see @imix's answer below for a variation on this idea (using RC style references). In that case, you could use =!RC
for the THIS_CELL
named range formula, or just use RC
directly.