Editor choice

How to Show Formula as Text in Another Cell in Excel (6 Ways)

Consider the List of Employee Salary dataset shown in the B4:F13 cells containing the Job ID, Name, Salary, Allowances, and Total Salary columns, respectively. We want to display the formula used to obtain the Total Salary.

Dataset for excel show formula as text in another cell


Method 1 – Using the Formulas Ribbon

Steps:

  • Go to the Formulas ribbon and click the Show Formulas button.

Note: We can also use the CTRL + ` (Tilde) keys to show the formulas.

Using Formulas Ribbon

Here’s the result.

Note: When using this method, Excel automatically changes the text alignment and the column width.

excel show formula as text in another cell using Formulas Ribbon


Method 2 – Utilizing Excel Options

Steps:

  • Click the File tab located at the top-left corner.

Utilizing Excel Options

  • Press the Options button at the bottom.

Clicking Options button

  • Move to the Advanced tab.
  • Scroll down to the Display options for this worksheet section.
  • Check Show formulas in cells instead of their calculated results.
  • Hit OK.

Enabling show formulas option from the advanced section

The results should resemble the image shown below.

Note: By default, Excel automatically increases the column width and changes the text alignment.

Excel show formula as text in another cell Utilizing Excel Options


Method 3 – Implementing the FORMULATEXT Function

Steps:

  • Go to the G5 cell and enter the formula given below.

=FORMULATEXT(F5)

The F5 cell refers to the Basic Salary of James.

  • Drag the Fill Handle tool down to copy the formula to the cells below.

Excel show formula as text in another cell with FORMULATEXT Function


Method 4 – Applying Find & Select


Case 4.1 – Inserting a Leading Apostrophe

Steps:

  • Select the F5:F13 cells.
  • Navigate to the Find & Select drop-down.
  • Choose the Replace option.

Inserting Leading Apostrophe

  • In the Find what field, enter an Equal sign.
  • In the Replace with field, type a leading Apostrophe and then an Equal sign.
  • Hit Replace All.

Steps for Find and Replace

  • Click OK to close the alert.
  • Hit Close.

The results should look like the picture given below.

Excel show formula as text in another cell by inserting Leading Apostrophe


Case 4.2 – Using a Leading Space

Steps:

  • Select the F5:F13 cells.
  • Proceed to Find & Select, then choose the Replace option.
  • In the Find what box, put an equals sign.
  • In the Replace with field, put a space and an equals sign.
  • Press Replace All.
  • Confirm and close the dialog.

Note: You can also press the Ctrl + H keys to directly open the Find & Replace dialog box.

Using Leading Space

The final output should appear in the screenshot below.

Excel show formula as text in another cell using Leading Space


Method 5 – Employing the Format Cells Option

Steps:

  • Go to the F5 cell and hit the Ctrl + 1 shortcut.

Employing Format Cells Option

  • In the Format Cells window, select the Text tab and click on OK.

Formatting as Text

  • Move to the F5 cell and press the F2 key, then hit Enter key.
  • Repeat the same process for the cells below.

The result should look like the figure given below.

excel show formula as text in another cell with Format Cells Option


Method 6 – Incorporating VBA Code

Steps:

  • Navigate to the Developer tab and click the Visual Basic button.

Incorporating VBA Code

  • Go to the Insert tab and select Module.

Inserting Module

  • Copy the code from here and paste it into the window as shown below.
Function Disp_Form(arr As range)
Disp_Form = arr.Formula
End Function

VBA Code

Code Breakdown
  • The name of the subroutine is Disp_Form()
  • We defined the argument arr and assign it as Range.
  • We used the Range.Formula property to display the formulas as text.

VBA Code explanation

  • Close the VBA window.
  • Go to the G5 cell and call the Disp_Form function.

=Disp_Form(F5)

The F5 cell represents James’s Basic Salary.

excel show formula as text in another cell with VBA code


Practice Section

We have provided a Practice section on the right side of each sheet so you can practice.

Practice Section


Download the Practice Workbook


Related Articles


<< Go Back To Show Excel Formulas | Excel Formulas | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Maruf Islam
Maruf Islam

MARUF ISLAM is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role, he creates techy content... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo