Show a cell's formula in text format in a linked cell

T

TreeHugger1

I want to show the formula for a specific cell in text format in anothe
cell.

For example, if cell A1 has a simple formula of "=10+64" (but only show
an answer of "74"), how can i link this cell to B1, so that B1 onl
shows as text "10+64" or " =10+64", instead of the actual answer
 
R

Ron Rosenfeld

I want to show the formula for a specific cell in text format in another
cell.

For example, if cell A1 has a simple formula of "=10+64" (but only shows
an answer of "74"), how can i link this cell to B1, so that B1 only
shows as text "10+64" or " =10+64", instead of the actual answer?

You can do this with a User Defined Function (UDF).

To enter this User Defined Function (UDF), <alt-F11> opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this User Defined Function (UDF), enter a formula like

=showformula(A1)

in B1.


======================
Function ShowFormula(rg As Range) As String
ShowFormula = rg.Formula
End Function
=======================
 
T

TreeHugger1

I want to show the formula for a specific cell in text format i another
cell.

For example, if cell A1 has a simple formula of "=10+64" (but onl shows
an answer of "74"), how can i link this cell to B1, so that B1 only
shows as text "10+64" or " =10+64", instead of the actual answer?

You can do this with a User Defined Function (UDF).

To enter this User Defined Function (UDF), <alt-F11> opens the Visua
Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this User Defined Function (UDF), enter a formula like

=showformula(A1)

in B1.


======================
Function ShowFormula(rg As Range) As String
ShowFormula = rg.Formula
End Function
======================
 

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