Formatting large datasets in Excel can be tedious, especially when the data is frequently updated or expanded. If you manually draw borders around your cells, you will constantly need to adjust them as new rows are added or deleted. Instead, you can use Excel’s Conditional Formatting feature to automatically apply borders to a cell the moment data is entered into it, creating a dynamic spreadsheet that formats itself.
How to Create the Conditional Formatting Rule
To make this work, we will use a simple formula that checks if a cell is not empty. If the cell contains any value, Excel will trigger the border formatting.
- Open your Excel spreadsheet and highlight the entire range of columns or rows where you expect to enter data (for example,
A1:F1000). - On the Home tab of the ribbon, click the Conditional Formatting button.
- Select New Rule… from the dropdown menu.
- In the dialog box, choose Use a formula to determine which cells to format.
- In the formula box, enter the following:
=A1<>""(Ensure that A1 corresponds to the top-left cell of the range you selected in Step 1). - Click the Format… button in the bottom right.
How to Configure the Border Style
Now that the rule is established, you need to define exactly what the border should look like when the cell is populated.
- In the Format Cells dialog box, click on the Border tab.
- Under the Line section, choose your preferred border style and colour.
- Under the Presets section, click the Outline button. You should see a preview of the border appear around the central box.
- Click OK to close the Format Cells box.
- Click OK again to close the New Formatting Rule dialog box.
The setup is now complete. Try typing any number or text into a blank cell within your selected range and press Enter. A border will instantly appear around that cell. If you delete the data, the border will vanish just as quickly.