Referring To Contents Of Formula

F

FARAZ QURESHI

Any idea how to refer to/use the contents of a formula in one cell in another
formula? For example you can type a formula like:
=Left(A1,5)
Now, suppose if cell A1 contains a formula like =Sum(... ... ...)
How, to get the first five characters of the formula existing in A1, i.e.
"=SUM(" ?
 
L

Lars-Åke Aspelin

Any idea how to refer to/use the contents of a formula in one cell in another
formula? For example you can type a formula like:
=Left(A1,5)
Now, suppose if cell A1 contains a formula like =Sum(... ... ...)
How, to get the first five characters of the formula existing in A1, i.e.
"=SUM(" ?


I don't think this can be done without using VBA.

Try the following User Defined Function:

Function get_formula(r As Range)
get_formula = r.Formula
End Function

The you can use it in a formula like

=LEFT(get_formula(A1),5)

Hope this helps / Lars-Åke
 
Top