Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

aladou
Lv 5
aladou asked in Computers & InternetSoftware · 9 years ago

I there an Excel function to read a formula?

Let's say I have this in cell A1:

=X30+100

Is there a worksheet function in Excel that will show me that formula, and (ideally) display it as a string?

e.g. in cell B1 I'd like to have a function that says =WhateverFunction(A1), and it will show "=X30+100" as the resulting value.

1 Answer

Relevance
  • Greg G
    Lv 7
    9 years ago
    Favorite Answer

    You'll need VBA for that. Alt + F11 and insert a new module, and paste this code:

    Function GetFormulaI(Cell as Range) as String

    'Application.Volatile = True

    If VarType(cell) = 8 And Not cell.HasFormula Then

    GetFormulaI = "'" & cell.Formula

    Else

    GetFormulaI = cell.Formula

    End If

    If cell.HasArray Then _

    GetFormulaI = "{" & cell.Formula & "}"

    End Function

    Now in B1, enter this:

    =GetFormulaI(A1)

Still have questions? Get your answers by asking now.