Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A UDF to emulate FORMULATEXT() in early versions of Excel ?? 1

Status
Not open for further replies.

Deniall

Technical User
May 15, 2011
250
Australia
I believe there is an Excel function called FORMULATEXT(CellAddress), which was introduced as part of Excel 365.[ ] You feed it the address of a cell that contains a formula, and it returns you the text of the formula, rather than the formula's value as displayed in the cell.

I am seeking something equivalent to this to use on earlier Excel versions, something that I suspect will have to be a User Defined Function in VBA.[ ] Does anyone know of such a UDF?
 
It was introduced back in Excel 2013

But, assuming you have a version older than that, then something like:

[blue]
Code:
Function GetFormulaText(cell_ref As Range) As String
    If cell_ref.HasFormula Then
        GetFormulaText = cell_ref.Formula
    End If
End Function
[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top