Formatting Issues

Hide a Cell Border with Conditional Formatting in Excel

Amos GikundaAmos Gikunda Nov 18, 2026 868 views

Question details

Show or hide a cell border based on the option selected in a drop-down list.

Hide a Cell Border with Conditional Formatting in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet uses a drop-down list to control whether an input cell looks like a bordered text box.
Observed behavior
The cell border should be hidden when the specified drop-down option is selected and visible for other selections.
Before you start

Identify the drop-down cell, the exact option text, and the cell whose border you want to control. The example below uses D2 and the option Product Range.

Solution 1Recommended

Apply the border only when the drop-down option does not match

Use a formula-based rule to show a border for other selections and leave it hidden when Product Range is selected.

Conditional formatting works reliably here when the normal cell format has no border and the rule adds the border when needed. Selecting None in a conditional format may not remove an existing normal border.

1
Remove the normal border

Select the input cell, then choose Home > Borders > No Border.

2
Create a formula rule

With the cell selected, choose Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format.

3
Enter the condition

Enter =$D$2<>"Product Range" in the formula box. Replace D2 and Product Range with your drop-down cell and exact option text.

4
Set the visible border

Select Format, open the Border tab, choose a line style and the border edges you want, then select OK to save the format and rule.

5
Test the drop-down

Select Product Range in D2 and confirm the border disappears. Select another option to confirm the border appears.

Apply the border only when the drop-down option does not match
Cell borders and text boxes: Conditional formatting affects cells, not separate text box shapes. Gridlines may still be visible when the cell border is hidden; use View > Gridlines to hide them across the worksheet.
Try it in WPS Spreadsheet

Control a cell border with a drop-down in WPS Spreadsheet

Use a formula-based conditional formatting rule in WPS Spreadsheet to display a cell border only when the selected drop-down option calls for it.

  1. 1. Open the workbook: Open the workbook in WPS Spreadsheet and identify the drop-down cell and the cell whose border you want to control.
  2. 2. Clear the normal border: Select the target cell and choose Home > Borders > No Border.
  3. 3. Add the rule: Choose Home > Conditional Formatting > New Rule, select the formula-based rule option, and enter =$D$2<>"Product Range", adjusting the cell reference and option text as needed.
  4. 4. Format and test: Set the desired border in the rule's formatting options, save the rule, and change the drop-down selection to check that the border appears and disappears.
Show or hide a cell border based on a drop-down valueOpen and edit Microsoft Excel XLSX and XLS filesWork in a familiar spreadsheet interfaceUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Why does selecting No Border in the conditional format not hide my existing border?

A conditional format with no border may leave the cell's normal border unchanged. Remove the normal border using Home > Borders > No Border, then use a conditional rule to add the border when it should be visible.

How do I show the border only when Product Range is selected?

Create a formula-based conditional formatting rule using =$D$2="Product Range", then set the desired border in the rule's Format > Border settings.

Why can I still see lines around the cell?

The lines may be worksheet gridlines rather than cell borders. In Excel, clear View > Gridlines to hide gridlines across the worksheet.

Can this rule hide an actual text box shape?

No. Conditional formatting changes cell formatting, not separate text box shapes. Use a bordered cell as the input area if you want the border to respond to a formula-based rule.