ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Referring To Contents Of Formula (https://www.excelbanter.com/excel-discussion-misc-queries/216827-referring-contents-formula.html)

FARAZ QURESHI

Referring To Contents Of Formula
 
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(" ?
--
Best Regards,
FARAZ A. QURESHI

Lars-Åke Aspelin[_2_]

Referring To Contents Of Formula
 
On Fri, 16 Jan 2009 21:52:01 -0800, FARAZ QURESHI
wrote:

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



RagDyeR

Referring To Contents Of Formula
 
This old post should help:

http://tinyurl.com/46af9t

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"FARAZ QURESHI" wrote in message
...
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(" ?
--
Best Regards,
FARAZ A. QURESHI




All times are GMT +1. The time now is 12:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com