Show the formula not the result

H

Haydie-lady

Is there a way to have a cell show the formula not the result? More
specifically show the formula with the values of the cells used to calculate
the result not the cell referenced. I want the cell next to my result(10) to
show the formula used to get my result, =5*2 OR =Height*Length NOT =B2*B3
EXAMPLE:

GIVEN
Height 5
Length 2
CALCULATED
Area 10
 
G

Gord Dibben

Try this UDF

Function EvalCell(RefCell As String)
Application.Volatile
EvalCell = Evaluate(RefCell)
End Function

In A1 enter 5*2 no = sign

In B1 enter =EvalCell(A1) returns 10


Gord Dibben MS Excel MVP
 
M

macropod

Hi Gordon,

I think Haydie-lady wants a formula that's been input in the form of =B2*B3 to display as =Height*Length or =5*2

Haydie-lady: Assuming B2 & B3 have the name ranges Height and Length, you could get =B2*B3 to display as =Height*Length by using
Find/Replace to change all instances of '=B2*B3' to '=Height*Length'.
 
G

Gord Dibben

It seems we differ on interpretation of OP's needs.

Only OP will know for sure.


Gord
 

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