Excel Conditional Formatting: Highlight Rows with Yes and a Nonblank Cell
Question details
Highlight an entire row when column N contains Yes and the corresponding cell in 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.
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.
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.
Select the cells you want to format, such as A3:Q100. Include every column that should be highlighted.
On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.
Enter =AND($N3="Yes",$Q3<>"") in the formula box. Replace 3 with the first row number of your selected range if necessary.
Select Format, choose a fill color, and select OK. Select OK again to create the rule for the selected range.

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. Open your spreadsheet: Open the workbook in WPS Spreadsheets and select the data range to highlight, such as A3:Q100.
- 2. Start a new rule: On the Home tab, select Conditional Formatting > New Rule and choose the option to use a formula.
- 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. Set the highlight: Select Format, choose a fill color, and confirm the rule to apply it to the selected cells.

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.




