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
 
Joined
Jan 17, 2009
Messages
4
Reaction score
0
oh yes...

use indirect function when referring to another cell data .it will convert that cells string to reference.
example:
In cell A1 ihave value "D"
in cell A2 i have value "1"

then = indirect(A1&A2) will return reference "D1"

hope i understood what u wanted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top