The Excel FormulaText function returns a formula as a text string.
Note: The FormulaText function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.
The syntax of the function is:
where the reference argument is a reference to a cell in an Excel worksheet. This may be in a different worksheet in the current workbook, or in another workbook that is currently open.
If the supplied reference refers to a workbook that is not currently open, the FormulaText function will return the #N/A error.
The Excel FormulaText function is used in cell C1 of the following spreadsheet, to display the formula from cell B4.
Formula:

Result:

For further details and examples of the Excel FormulaText function, see the Microsoft Office website
If you get an error from the Excel FormulaText function, this is likely to be one of the following:
#N/A   
Occurs if the supplied cell reference:

#VALUE!    Occurs if the supplied reference is not a valid cell reference. 