How do I obtain a reference to the current cell?
For example, if I want to display the width of column A, I could use the following:
=CELL("width", A2)
However, I want the formula to be something like this:
=CELL("width", THIS_CELL)
From stackoverflow
-
A2
is already a relative reference and will change when you move the cell or copy the formula.GSerg : Don't worry about addressing style. All formulas use R1C1 internally anyway, it doesn't matter.Joey : Ah, thanks. Didn't bother to look it up right now (wading through the XML isn't exactly fun usually :)) -
You could use
=CELL("width", INDIRECT(ADDRESS(ROW(), COLUMN())))
but Johannes's answer will work just as well
GSerg : This makes the formula volatile. Therefore, provided there are non-volatile solutions, don't use this one. -
Leave off the second argument entirely, it is an optional argument. When you omit it, the function uses the host cell as the reference.
=CELL("width")
0 comments:
Post a Comment