Hide Unhide Formulas Cell Contents?
This article explains how to hide and unhide formulas and cell contents in Microsoft Excel and Google Sheets, covering the methods for protecting formulas from viewing and for revealing hidden ones. You will learn the exact steps for both applications, along with common pitfalls and answers to frequently asked questions.
Why Hide Formulas?
Hiding formulas is a common need for spreadsheet creators who want to protect their intellectual property or simply prevent accidental edits. When you hide a formula, the cell still shows the result, but the formula bar does not display the underlying calculation. This is different from hiding the entire column or row, which removes the data from view entirely. Hiding formulas requires a combination of cell formatting and worksheet protection, because merely setting the cell’s “Hidden” property does nothing until the sheet is protected.
How to Hide Formulas in Excel
In Microsoft Excel, the process involves two main steps: marking the cells as “Hidden” and then protecting the worksheet. Here is the step-by-step procedure for Excel 2016, 2019, 2021, and Microsoft 365:
- Select the cell or range of cells that contain the formulas you want to hide.
- Right-click the selection and choose Format Cells (or press Ctrl+1).
- Go to the Protection tab and check the Hidden box. Click OK.
- Now protect the sheet: go to the Review tab and click Protect Sheet.
- In the dialog, you can set a password (optional) and choose what users can do. Ensure that “Select locked cells” is checked if you want users to be able to click on the cells. Click OK.
After these steps, when a user selects a cell with a hidden formula, the formula bar will be blank. The cell still shows the calculated value. To unhide, unprotect the sheet (Review > Unprotect Sheet) and then uncheck the Hidden box in Format Cells.
How to Hide Formulas in Google Sheets
Google Sheets does not have a direct “Hide Formula” checkbox like Excel, but you can achieve the same result by protecting a range and then hiding the formula bar for that range. However, the most common method is to protect the entire sheet and then use a script or a workaround. Here is the standard approach:
- Select the cells with formulas.
- Go to Data > Protect sheets and ranges.
- Click Add a sheet or range.
- Ensure the range is correct, then click Set permissions.
- Choose “Only you” or restrict editing to specific people. Click Done.
This prevents others from editing the formulas, but they can still see the formula in the formula bar when they click the cell. To hide the formula bar entirely, you would need to use Google Apps Script to set the cell’s “hidden” property, which is not a built-in feature. A simpler workaround is to hide the entire column or use a custom function that obscures the formula, but these are not true formula hiding.
How to Unhide Formulas
Unhiding formulas is the reverse of hiding. In Excel, you must first unprotect the sheet (Review > Unprotect Sheet, enter password if prompted). Then select the cells, open Format Cells (Ctrl+1), go to the Protection tab, and uncheck the Hidden box. Click OK. The formulas will now appear in the formula bar again.
In Google Sheets, if you used the protection method, you can remove the protection by going to Data > Protect sheets and ranges, clicking the trash icon next to the protected range, and confirming. If you used a script to hide formulas, you would need to run a script to unhide them, which is beyond the scope of typical user actions.
Common Mistakes and Troubleshooting
One of the most common mistakes is forgetting to protect the sheet after setting the Hidden property. Without protection, the Hidden property has no effect, and formulas remain visible. Another mistake is protecting the sheet but not allowing users to select cells, which can make the sheet frustrating to use. In Excel, if you want users to be able to click on cells but not see formulas, make sure “Select locked cells” is checked in the Protect Sheet dialog.
If you have hidden formulas and then forget the password, you cannot unhide them easily. There is no built-in way to recover a lost password in Excel, though some third-party tools claim to do so. Always keep a backup of your workbook without protection.
Alternatives to Hiding Formulas
If hiding formulas is too complicated or you want to avoid the restrictions of sheet protection, consider these alternatives:
- Use a custom number format to display a different value than the actual formula result, but this does not hide the formula itself.
- Move formulas to a separate hidden sheet and reference the results on the main sheet. Users can see the values but not the formulas unless they unhide the sheet.
- Convert formulas to values (Paste Special > Values) if you no longer need the calculations. This permanently removes the formulas.
- Use a third-party add-in that offers advanced formula hiding, but be cautious about security and compatibility.
Frequently Asked Questions
Why can I still see formulas after hiding them?
You likely forgot to protect the sheet. In Excel, the Hidden property only takes effect after you protect the worksheet. In Google Sheets, you need to protect the range or sheet to prevent editing, but that alone does not hide the formula bar; you would need a script.
Can I hide formulas without protecting the sheet?
No, not in a way that prevents others from seeing them. Without protection, anyone can select the cell and see the formula in the formula bar. The only way to hide formulas is to combine the Hidden property with sheet protection.
How do I hide formulas in Excel but still allow data entry?
You can hide formulas in specific cells while allowing data entry in others by setting the Hidden property only for the formula cells, then protecting the sheet. In the Protect Sheet dialog, ensure “Select unlocked cells” is checked so users can click into input cells. The formula cells will be locked and hidden.
Does hiding formulas affect calculation?
No, hiding formulas only affects visibility. The formulas continue to calculate normally. If you want to stop calculation, you would need to convert them to values or set calculation to manual.
Can I hide formulas in Google Sheets using a simple method?
There is no simple built-in method. The most straightforward way is to protect the sheet and then use a Google Apps Script to set the cell’s hidden property. Alternatively, you can hide the entire column or use a custom function that obscures the formula, but these are not true formula hiding.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.