ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to reference the formula in a cell. (https://www.excelbanter.com/excel-discussion-misc-queries/247274-how-reference-formula-cell.html)

fasta13

How to reference the formula in a cell.
 
Is there a function in excel that I am missing which will reference the
formula in a cell and not the value (recalculating that formula in the new
cell)?

If not, can someone who has a macro which does this post it please, it would
be very helpful.

Gord Dibben

How to reference the formula in a cell.
 
Not too clear on what you want.

Function showfn(mycell)
If mycell.HasFormula Then
showfn = Mid(mycell.Formula, 2)
Else
showfn = ""
End If
End Function

=showfn(A1) entered in B1

Will show the formula from A1 without the "=" sign.


Gord Dibben MS Excel MVP

On Mon, 2 Nov 2009 16:16:01 -0800, fasta13
wrote:

Is there a function in excel that I am missing which will reference the
formula in a cell and not the value (recalculating that formula in the new
cell)?

If not, can someone who has a macro which does this post it please, it would
be very helpful.



Geoff_L[_2_]

How to reference the formula in a cell.
 
Not exactly sure what your scenario is but have you checked out the
'INDIRECT' function? This references a formula in another cell and
effectively incorporates it within the formula with the INDIRECT function
within it.

Helpful? Hit Yes.

"fasta13" wrote:

Is there a function in excel that I am missing which will reference the
formula in a cell and not the value (recalculating that formula in the new
cell)?

If not, can someone who has a macro which does this post it please, it would
be very helpful.


Stefi

How to reference the formula in a cell.
 
A very simple UDF does the job:

Function retform(fcell As Range)
retform = fcell.Formula
End Function

Usage:

=retform(B2) in C2 returns the formula in B2.

Regards,
Stefi


€˛fasta13€¯ ezt Ć*rta:

Is there a function in excel that I am missing which will reference the
formula in a cell and not the value (recalculating that formula in the new
cell)?

If not, can someone who has a macro which does this post it please, it would
be very helpful.



All times are GMT +1. The time now is 09:18 PM.

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