Excel has no built-in function to directly copy a formula and later paste it as text. Whatever you paste in Excel cells, if it resembles a formula syntax, Excel considers it as a formula and tries to return its value. But today in this article, you will learn 2 exclusive methods to copy a formula and paste it as text in Excel with ease.
How to Copy a Formula and Paste as Text in Excel: 2 Easy Ways
1. Use Text Import Wizard and Notepad to Copy a Formula and Paste it as Text in Excel
This is going to be a long procedure. That’s why I’m gonna break it into several sections for your convenience. So let’s get started.
1.1 Display Cell Formulas
In the following screenshot, you can see the formula result in column E.
At first, we will show the underlying formulas in that column. Later, you will copy those formulas and paste them into another column as texts.
To show the hidden formula, we will use a function called FORMULATEXT.
Now follow the steps below to show the hidden formulas using the FORMULATEXT Function.
❶ First, create a new column with a column header such as Formula.
❷ After that type the following formula in cell F5.
This formula will display the cell formula hidden in cell E5.
❸ Now hit the ENTER button to execute the formula.
This will show the hidden formula used in cell E5 in cell F5.
❹ To apply the formula all over the Formula column, drag the Fill Handle icon to the end of the column, Formula.
After that, you will see all the formulas used in column E as in the picture below:
1.2 Use Notepad
Now you need to copy the formulas into Notepad and then copy them back into the Excel worksheet.
To do that,
❶ Select all the formulas in column F.
❷ Then press CTRL + C to copy them all.
❸ After that go back to the Windows desktop and right-click on it.
❹ From the pop-up menu, choose New.
❺ Then follow the arrow direction and select Text Document.
This will open the Notepad.
❻ Now press CTRL + V to paste the copied formulas into the Notepad.
❼ After that, select all the formulas again in Notepad and press CTRL + C to copy them all.
1.3 Use Text Import Wizard
❶ Now create another new column, where you want to paste the formulas as text.
I’ve created a column called Formula as Text in column H.
❷ Now select the top cell of the newly created column.
❸ Then go to Home > Paste > Use Text Import Wizard.
❹ A dialog box will appear. Make sure the option Delimited is checked and hit the Next button.
❺ After that, all the Delimiter options will appear. Uncheck them all and hit the Next button once again.
❻ In the next dialog box, from the Column Data Format section select Text and hit the Finish button.
After following all the steps above, you will see the formulas have been pasted as text in the column called Formula as Text in column H.
2. Use VBA Code to Copy a Formula and Paste It as Text in Excel
To use the VBA Code,
❶ First of all, press the ALT + F11 buttons to open the VBA editor.
❷ Then create a new Module from the Insert tab.
❸ Now copy the following VBA code.
Dim aa As Long
Dim bb As Long
Dim cc As String
Dim dd As String
aa = Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, LookIn:=xlFormulas).Column + 1
bb = Cells(Rows.Count, "E").End(xlUp).Row
cc = Columns("E").SpecialCells(xlCellTypeFormulas)(1).Formula
dd = Left(cc, 3)
With Cells(1, aa).Resize(bb)
.Value = Range("E1:E" & bb).Formula
.Replace dd, Mid(dd, 2), xlPart
❹ After that paste and save the above code in the VBA code editor.
Now it’s time to run the code. To do that,
❺ Press ALT + F8 key together. This will open the Macro dialog box.
❻ Just hit on the Run button.
After that, you will see all the formulas in column E have been pasted to the next column as in the picture below:
Things to Remember
- Press ALT + F11 to open the VBA code editor.
- You can press ALT + F8 to open the Macro dialog box.
- To run the VBA code press the F5 button.
Download Practice Workbook
You can download the Excel file from the following link and practice along with it.
To sum up, we have discussed 2 ways to copy a formula and paste it as text in Excel. You are recommended to download the practice workbook attached along with this article and practice all the methods with that. And don’t hesitate to ask any questions in the comment section below. We will try to respond to all the relevant queries ASAP.
- How to Copy and Paste Formulas from One Workbook to Another in Excel
- [Fixed] Excel Not Copying Formulas, Only Values
- VBA to Copy Formula from Cell Above in Excel
- Excel VBA to Copy Formula with Relative Reference