Formatting Issues

How to Highlight an Excel Cell When All Cells Contain YES

Maira MehtabMaira Mehtab Oct 12, 2026 870 views

Question details

The user needs to highlight a master cell (A8) green using conditional formatting when all cells in a specific range (H8:L8) contain the word 'YES', with an option to also treat 'NA' as an acceptable value.

How to Highlight an Excel Cell When All Cells Contain YES
Product
Excel
Device & OS
not provided
Scenario
Tracking task completion or status in a spreadsheet where a summary cell visually changes color based on the uniform status of multiple dependent cells.
Observed behavior
The goal is to automatically format cell A8 to turn green exclusively when cells H8 through L8 all read 'YES', or a combination of 'YES' and 'NA'.
Before you start

Ensure that your data range (H8:L8) does not contain hidden spaces or spelling variations, as the COUNTIF function requires an exact text match to work correctly.

Solution 1Recommended

Use Conditional Formatting with COUNTIF for 'YES'

Apply a formula-based conditional formatting rule to highlight the target cell when every cell in your range equals exactly 'YES'.

This method uses the COUNTIF function to verify that the number of cells containing 'YES' matches the total number of cells in the range. In this scenario, checking H8 through L8 involves exactly 5 cells.

1
Select the Target Cell

Click on cell A8 (or whichever cell you want to highlight) to select it.

2
Open Conditional Formatting

Navigate to the Home tab on the Excel ribbon, click on 'Conditional Formatting', and select 'New Rule' from the drop-down menu.

3
Enter the Formula

Choose 'Use a formula to determine which cells to format'. In the formula box, enter exactly: =COUNTIF(H8:L8,"YES")=5

4
Apply the Format

Click the 'Format' button, go to the 'Fill' tab, choose the color green, and click 'OK' twice to apply the rule.

Use Conditional Formatting with COUNTIF for 'YES'
Formula Customization: If your range contains a different number of cells (e.g., 7 cells), remember to change the =5 at the end of the formula to =7.
Advanced Data Formatting

Easily Apply Conditional Formatting in WPS Spreadsheet

WPS Spreadsheet provides a seamless environment for conditional formatting. You can effortlessly apply rules, like counting specific text values, with the exact same formulas used in Microsoft Excel.

  1. 1. Open Your Spreadsheet: Launch WPS Spreadsheet and open your workbook. Select the target cell you wish to highlight (e.g., A8).
  2. 2. Access Conditional Formatting: Navigate to the 'Home' tab and click on the 'Conditional Formatting' icon.
  3. 3. Create a New Formula Rule: Select 'New Rule', choose 'Use a formula to determine which cells to format', and input your COUNTIF formula.
  4. 4. Format and Save: Click the 'Format' button to select a green background color, then click 'OK' to save and apply the rule.
Full compatibility with Microsoft Excel formulas, functions, and .xlsx formats.Intuitive and user-friendly interface for applying and managing Conditional Formatting.Completely free to use with lightweight installation and fast performance for large datasets.
QA img-9

Frequently Asked Questions

Why isn't my conditional formatting working even though all cells say YES?

This is often caused by invisible leading or trailing spaces in your cells. The COUNTIF formula looks for exact text matches. Double-check your data for extra spaces, or use the TRIM function to clean your cells.

How can I apply this formatting rule to an entire column of rows?

You can modify your formula to use mixed references. Use =COUNTIF($H8:$L8,"YES")=5 in cell A8. Then, select A8, click 'Format Painter', and drag it down the column. The absolute column references ($) keep the range locked, while the row numbers adjust automatically.

Can I use the AND function instead of COUNTIF for this?

Yes. For a small range, you can use a formula like =AND(H8="YES", I8="YES", J8="YES", K8="YES", L8="YES"). However, using COUNTIF is much more efficient and easier to update, especially for larger ranges.

What if my range has more or fewer than 5 cells?

You must adjust the number at the end of the COUNTIF formula to match the exact number of cells in your range. For example, if you are checking 8 cells, change the end of the formula from =5 to =8.