How to Highlight an Excel Cell When All Cells Contain YES
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.

- 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'.
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.
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.
Click on cell A8 (or whichever cell you want to highlight) to select it.
Navigate to the Home tab on the Excel ribbon, click on 'Conditional Formatting', and select 'New Rule' from the drop-down menu.
Choose 'Use a formula to determine which cells to format'. In the formula box, enter exactly: =COUNTIF(H8:L8,"YES")=5
Click the 'Format' button, go to the 'Fill' tab, choose the color green, and click 'OK' twice to apply the rule.

Allow Both 'YES' and 'NA' as Acceptable Values
Expand the conditional formatting rule to trigger the highlight when the cells contain either 'YES' or 'NA'.
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. Open Your Spreadsheet: Launch WPS Spreadsheet and open your workbook. Select the target cell you wish to highlight (e.g., A8).
- 2. Access Conditional Formatting: Navigate to the 'Home' tab and click on the 'Conditional Formatting' icon.
- 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. Format and Save: Click the 'Format' button to select a green background color, then click 'OK' to save and apply the rule.

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.




