How could I get the text defining an Excel formula for one cell into another cell?

1

In other words, if the value of a cell, say A1, is =Date(), then displayed in cell A1 I will see the date, but then I want B1 to be =FuncText(A1), then I want to see 'Date()' displayed in cell B1.

To emphasize, I want to see the text 'Date()', i.e. the six chars ending with a ')' in B1.

ProfK

Posted 2011-12-20T17:46:46.480

Reputation: 2 094

Answers

1

In B1 Cell, write =A1

So you will see the A1 Cell Date in B1 Cell too

Updated as per your information:-

Function FuncText(fma As Range) 
    If fma.HasFormula Then 
        FuncText = fma.Formula 
    Else: FuncText = fma 
    End If 
End Function 

Output:

On B1 Cell, returns as "=Date()"

But if you want exactly as "Date()" then use below function

Function FuncText(fma As Range)
    If fma.HasFormula Then
        FuncText = Mid(fma.Formula, 2, Len(fma.Formula))
    Else: FuncText = Mid(fma, 2, Len(fma))
    End If
End Function

Siva Charan

Posted 2011-12-20T17:46:46.480

Reputation: 4 026

You misunderstand me, I want to see the text 'Date()', i.e. the six chars ending with a ')' in B1. – ProfK – 2011-12-20T18:06:14.843

updated my answer, as per your update. – Siva Charan – 2011-12-20T18:24:27.353

1

Quick & simple. You'll need to make a user-defined function to do this... but it's do-able:

http://dmcritchie.mvps.org/excel/formula.htm

TheCompWiz

Posted 2011-12-20T17:46:46.480

Reputation: 9 161

2

Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.

– Der Hochstapler – 2012-07-23T17:47:15.157