This tutorial will explain how to hide the formula in excel without protecting the sheet. While working in Microsoft Excel we might need to share our excel files with other users. We can protect our worksheet with a password so that the user will not be able to edit anything.
But, despite protecting the worksheet, users can click on a cell and see what formula we have used in that cell. We can hide formulas by protecting the sheet also but in this tutorial, we will hide formulas from users without protecting the sheet.
Download Practice Workbook
We can download the practice workbook from here.
2 Methods to Hide Formula in Excel without Protecting Sheet
Throughout this article, we will explain 2 methods of how to hide the formula in excel without protecting the sheet. To illustrate those methods we will use the dataset that is provided in the following screenshot. The dataset consists of sales of six salespeople in January and February. Then, we can see the total sales in another column.
1. Use VBA Code to Hide Formula in Excel without Protecting Sheet
Just go through the following steps to understand this method clearly.
- If we click on cell E5 we can see the following formula in the formula bar:
- Now, users can see the formulas of the following image in the formula bar just by clicking on that cell.
We want to limit this access. We will apply a VBA code so that the users will only be able to see the data but will not be able to see what formula we are using.
Let’s see the steps to perform this action.
- To begin with, right-click on the sheet name. Select the option ‘View Code’.
- The above command will open a blank VBA module.
- In addition, insert the following code in the blank VBA module:
Dim zDic As New Dictionary Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim zCell As Range Dim zRg As Range Set zRg = Range("E5:E10") If zDic.Count <> zRg.Count Then For Each zCell In zRg zDic.Add zCell.Address, zCell.FormulaR1C1 Next End If If (Target.Count = 1) And (Not Application.Intersect(zRg, Target) Is Nothing) And (Target.HasFormula) Then With Target .Value = .Value End With Else For Each zCell In zRg zCell.Formula = zDic.Item(zCell.Address) Next End If End Sub
- Furthermore, go to the Tools and click on the option References.
- A new dialogue box named ‘References – VBAProject’ will appear.
- Next, check the ‘Microsoft Scripting Runtime’ box from the ‘Available References’ section.
- Then, click on OK.
- After that, press Alt + Q to close the VBA module.
- Lastly, click on cell E5. We can see that the formula bar is showing only the value instead of the formula
2. Hide Formula Bar to Conceal Formula in Excel without Protecting Sheet
Another easy trick to hide formulas in excel without protecting the sheet is to hide the formula bar from the excel ribbon. In the following figure, we can see that, if we select cell E5 the formula of that cell becomes visible in the formula bar.
Let’s see the steps to hide the formula bar.
- First, go to the File tab.
- Next, select Options.
- Then, the above command will open a new dialogue box named ‘Excel Options’.
- After that, select the Advanced option from that box.
- Furthermore, uncheck the ‘Show formula bar’ box from the Display section and click on OK.
- Finally, the formula bar disappears from the ribbon. Now, if we select any cell that contains a formula, the formula will not appear in the formula bar.
Find Cells with Formulas in Excel
Suppose we have hidden the formulas of our worksheet. Now we just want to know which cells contain formulas. But we do not want to reveal the formulas. In the following dataset, we will figure out which cells contain formulas.
Let’s see the steps of this method.
- Firstly, go to the Home tab.
- Secondly, select the option ‘Find & Select’ from the excel ribbon.
- Thirdly, select the option Formulas from the drop-down menu.
- Lastly, we can see the cells (E5:E10) that contain formulas are selected in our dataset.
In conclusion, in this article, we have shown how to hide formulas in excel without protecting the sheet. Download the practice worksheet that comes with this article to put your skills to the test. If you have any questions, please leave a comment in the box below. We’ll do our best to respond as soon as possible. Keep an eye out for more intriguing Microsoft Excel solutions in the future.