Formula in Excel 07 to get the formula used in one cell in anothercell, showing VALUES, not cells re

T

TobiasAL

Hi,

I'm gonna illustrate this by an example as I think it is the easiest
way to explain what I need:

A1 = 10
A2 = 5
A3 = 2 because A3 = A1/A2

Now, what I want is to be able to in cell B3 to write some sort of
formula e.g. =GetFormula(A3) that will give me:
=10/5 and NOT =A1/A2 , NOR 2

Does anyone know what I can do?

I don't know how to work with VBA or anything, but I know how to copy-
paste if you know the codes.

I previously got the following answer:

-------------------------

Here is a custom function that will do what you want.

To install the custom function:
Alt+F11 to open the VBA editor
Select from the VBA menu: Insert\ Module
Paste the code below in the VBA edit window

Back in Excel use the formula =GetFormula(A3) to get the formula of
cell A3

---

Function GetFormula(rng As Range) As String
GetFormula = rng.Formula
End Function

-------------------------

But it returns the cell references (=A1/A2) that have been used, not
the actual numbers in those cells (=10/5).

Anyway to get it to show the values?

I know the VALUE(ROUND(CELL,DECIMALS))"& and so forth, but it is very
time consuming.

Hope you can help!
 
B

Bernard Liengme

Does this fill your needs?
="=" & A1 & "/" & A2

Please use white space (here) for questions
The Subject line should be very brief
best wishes
 
T

TobiasAL

Does this fill your needs?
="=" & A1 & "/" & A2

Please use white space (here) for questions
The Subject line should be very brief
best wishes

Well, honestly no. It is still very time consuming, and since this is
for use in a written exam, time is not in abundance.

I have later found and tried the following VBA module

Function GetFormula(Cell As Range) As String
GetFormula = Cell.Formula
End Function

and it can return the formula showing values, not cells. But only if
the target cell is not calculated using other cells... E.g. it can
find A1=4+5 but not A1=A2+A3 w. A2=4 and A3=5...

Any idea as to what I can do?
 

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