return a formula as text in another cell

shodan

Active Member
Joined
Jul 6, 2005
Messages
486
Hi board,

I a cell I have entered a formula. now I would like to see this formula again as text in another cell. in fact, I would lilke to retrieve the filename this formula is using.

Any ideas for me?

Thanks,
shodan
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
UDF
Code:
[COLOR="Blue"]Function[/COLOR] FormulaAsText(rng [COLOR="Blue"]As[/COLOR] Range) [COLOR="Blue"]As[/COLOR] [COLOR="Blue"]String[/COLOR]
    FormulaAsText = rng.Formula
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Function[/COLOR]
 
Upvote 0
Paste this UDF into a standard module:

Public Function FormulaText(rng As Range) As String
FormulaText = rng.Formula
End Function
Excel Workbook
AB
11,701.00<< The Sum formula using Cells C1:C5
2=SUM(C1:C5)<< The actual formula that is in Cell A1
Sheet1
Excel 2007
Cell Formulas
RangeFormula
A1=SUM(C1:C5)
A2=formulatext(A1)
 
Upvote 0
thanks guys,

This is indeed what I saw a few times on the net, so I suppose there is not standard funtion to do this.

Let's try this one!
regards
shodan
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,628
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top