Skip to main content
 

Excel FORMULATEXT function

Author: Sun Last Modified: 2019-06-21

doc formulatext function 1

Description

Syntax and Arguments

Usage and Examples


Description

The FORMULATEXT function is used to display or return a formula as a text string from a given reference.

Syntax and Arguments

Formula syntax

FORMULATEXT(reference)

Arguments

  • Reference: Required, a cell or a range of cells. If the reference is a range of cell, it will return the text string of formula applied in the first cell of this range.

Return Value

The FORMULATEXT function returns a formula as text string.

About Errors

The result is #N/A error value if:
1) The reference cell does not contain a formula;
2) The formula in the referenced cell is longer than 8192 characters;
3) Worksheet is protected from displaying formula;
4) The external workbook which contains formula is closed.

The result is #VALUE! error value if:
1) Some invalid character typed in function.

Usage and Examples

Here I take some simple examples to explain how to use the FORMULATEXT function in Excel.

Ex1: Basic use-display cell’s formula

Formula

=FORMULAR(A2)

A1 contains the formula =TODAY() and returns today’ s date,

B2 contains the formula =FORMULATEXT(A2) and returns the text string what displays in the formula bar from cell A2

Result: Display the formula applied in Cell A2 as a text string
doc formulatext function 2


Ex2: Count length of formula

Formula

=LEN((FORMULATEXT(A3)))

Explain:

LEN: count characters of a cell

LEN((FORMULATEXT(reference))): count the number of characters of formula from reference.

Result: Count the length of formula In Cell A3
doc formulatext function 3


Ex3: Display formula of another cell

Formula

=FORMULATEXT(INDIRECT(B5))

Explain:

INDIRECT(B5): display the value in Cell B5. in my example, the Cell B5 contains the value “B2”.

then

FORMULARTEXR(INDIRECT(B5)) equals to FORMULATEXT(B2)

Result: Display the formula applied in Cell B2
doc formulatext function 4


Ex4: Display formula or a message

If the reference not contain a formula, the FORMULATEXT function will returns #N/A error value as below screenshot shown. To avoide the error value appearing, you can combine the ISFORMULA function and the FORMULATEXT function to display formula or a message based on the reference.
doc formulatext function 5

Formula

=IF(ISFORMULA(A2),FORMULATEXT(A2),"not a formula")

Explain

If Cell A2 contains a formula, then execute the FORMULATEXT function; if not, display the text string “not a formula”.
doc formulatext function 6

Note:This FORMULATEXT functions is a newly added since Excel 2013


Sample File
doc sample file


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...


Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.