How to Hide Formulas and Display Values in Excel (2 Ways)

Method 1 – Formatting Cells to Hide Formulas and Display Values in Excel

In the sample dataset, we have used the SUM function to calculate the total sales from the upper 3 rows. We can see the formula used in the formula bar (fx).

Formatting Cells to Hide Formulas and Display Values

Steps

  • Select the cell/cells to modify, in this case, it is the total sales cell C8.

formula to hide and display values

  • Go to Home tab, select Number group and click on the dialog box launcher.A new Dialog box for formatting will pop up.

  • In the “Format Cells” box, select the Protection Check the “Hidden” option. Click OK.

Formatting Cells options to Hide Formulas and Display Values

  • Go to the Review tab. Under the Protect group select “Protect Sheet”.

  • Make sure the “Protect worksheet and contents of locked cells” option is checked. Click OK.

protect sheet options to hide formulas and display values

You will not see any formula in the formula box, but the value will be displayed in the cell.

formula hidden in formula bar and display only values

Read More: How to Hide Formula in Excel without Protecting Sheet


Method 2 – Using VBA Macro to Hide Formulas in Excel and Display Values

Steps

  • If you don’t have the Developer tab, see how to show the Developer tab.
  • Under the “Developer” tab, select “Visual Basic”. The VBA interface will pop up.

Opening vba window

  • Select “Insert” and click on “Module”. This will create a new module.

inserting module in vba window

  • In the VBA editor, enter the following codes.
Sub HideFormulasDisplayValues()

With ActiveSheet
.Unprotect
.Cells.Locked = False
.Cells.SpecialCells(xlCellTypeFormulas).Locked = True
.Cells.SpecialCells(xlCellTypeFormulas).FormulaHidden = True
.Protect AllowDeletingRows:=True
End With

End Sub
  • Select “Macros” from either the “View” tab or the “Developer” tab.

  • Select “HideFormulasDisplayValues”(our macro name) from the macros list and click on Run.

This will remove all the formulas in the selected sheet and display only values in the cells.

Hide the Formulas and Display Values with VBA

Note: you have to save the file as Excel Macro-Enabled Workbook (.xlsm extension) to use VBA.


Download Practice Workbook


Related Articles


<< Go Back to Hide Excel Formulas | Excel Formulas | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!

Leave a Reply

Your email address will not be published. Required fields are marked *

Advanced Excel Exercises with Solutions PDF