Formatting Issues

Excel Conditional Formatting: Highlight Rows with Yes and a Nonblank Cell

Aamir Naveed AkramAamir Naveed Akram Dec 2, 2026 869 views

Question details

Highlight an entire row when column N contains Yes and the corresponding cell in column Q is not blank.

Highlight Excel Rows When Column N Is Yes and Column Q Is Not Blank
Product
Microsoft Excel
Device & OS
not provided
Scenario
Apply conditional formatting across a data range using values from two columns in each row.
Observed behavior
Rows should be highlighted only when both conditions are met.
Before you start

Identify the first data row and the full range of columns you want to highlight. The row number in the formula must match the first row of the selected range.

Solution 1Recommended

Create a Formula-Based Conditional Formatting Rule in Excel

Use this rule to highlight each row where column N is Yes and column Q is not blank.

1
Select the data range

Select the cells you want to format, such as A3:Q100. Include every column that should be highlighted.

2
Create a formula rule

On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.

3
Enter the formula

Enter =AND($N3="Yes",$Q3<>"") in the formula box. Replace 3 with the first row number of your selected range if necessary.

4
Choose the formatting

Select Format, choose a fill color, and select OK. Select OK again to create the rule for the selected range.

Create a Formula-Based Conditional Formatting Rule in Excel
How the references work: The dollar signs keep the checks in columns N and Q, while the row numbers adjust for each row in the selected range.
WPS Office

Highlight Matching Rows in WPS Spreadsheets

Use a formula-based conditional formatting rule in WPS Spreadsheets to highlight rows when column N is Yes and column Q is not blank.

  1. 1. Open your spreadsheet: Open the workbook in WPS Spreadsheets and select the data range to highlight, such as A3:Q100.
  2. 2. Start a new rule: On the Home tab, select Conditional Formatting > New Rule and choose the option to use a formula.
  3. 3. Enter the conditions: Enter =AND($N3="Yes",$Q3<>"") in the formula box. Change 3 to the first row of your selected range if needed.
  4. 4. Set the highlight: Select Format, choose a fill color, and confirm the rule to apply it to the selected cells.
Highlight entire rows based on conditions in two columnsOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formatting toolsWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why is the wrong row being highlighted?

Check that the row number in the formula matches the first row of the range selected for the rule. For example, use $N3 and $Q3 if the range starts on row 3.

How do I highlight more columns in each matching row?

Select the full desired range before creating the rule, such as A3:Z100. For an existing rule, go to Home > Conditional Formatting > Manage Rules and adjust its Applies to range.

Will a cell containing only spaces count as nonblank?

Yes. The condition $Q3<>"" treats spaces as content. To ignore cells containing only ordinary spaces, use =AND($N3="Yes",LEN(TRIM($Q3))>0).

Will the rule highlight a row if column Q contains a formula that returns an empty string?

No. The condition $Q3<>"" treats a formula result of an empty string as blank, so that row will not be highlighted.