Hiding the contents of a cell

Suppose we have several cells, the contents of which we want to hide from the cursory glance of a stranger, without hiding the rows or columns with data themselves and without setting a password that can be forgotten. You can, of course, format them in the style of “white font on white background”, but this is not very sporty, and the fill color of the cells is not always white. Therefore, we will go the other way.

First, let’s create a custom cell style that hides its contents using a custom format. In the tab Home in the list of styles find the style Normal, right click on it and select the command Duplicate:

In the window that appears after this, enter any name for the style (for example Secret), uncheck all the checkboxes except the first one (so that the style does not change the rest of the cell parameters) and click Format:

On the Advanced tab Number select option All formats (Custom) and enter in the field Type three semicolons in a row without spaces:

Close all windows by clicking on OK… We’ve just created a custom format that will hide the contents of the selected cells and will only be visible in the formula bar when each individual cell is selected:

How it really works

In fact, everything is simple. Any custom format can consist of 4 mask fragments separated by semicolons, where each fragment is applied in a specific case:

  1. The first is if the number in the cell is greater than zero
  2. Second – if less
  3. Third – if there is zero in the cell
  4. Fourth – if there is text in the cell

Excel treats three semicolons in a row as four empty masks for all four possible cases, i.e. outputs emptiness for any cell value. 

  • How to create your own custom formats (persons, kg, thousand rubles, etc.)
  • How to put password protection on Excel cells, sheets and workbooks

Leave a Reply