Excel Formula to Evaluate Y, N, NA, and Blank Cells
Question details
Create a row-level result from cells containing Y, N, NA, or blanks, leaving the result blank when the row is empty.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Evaluate several status cells in each row and return a single result based on their priority.
- Observed behavior
- The desired result is N if any cell contains N; otherwise Y if any cell contains Y; otherwise a blank result.
Identify the cells to evaluate in each row and choose a result column outside that range. The examples use B2:G2 and treat NA as text, not as the #N/A error.
Use COUNTIF to prioritize N over Y
Use this formula for a straightforward row-level result in Excel.
Click H2, or another empty cell outside the B2:G2 input range.
Type =IF(COUNTIF(B2:G2,"N")>0,"N",IF(COUNTIF(B2:G2,"Y")>0,"Y","")) in the formula bar and press Enter.
Drag the fill handle from H2 down the result column. Change B2:G2 in the formula if your input cells use a different range.

Use IFS and XMATCH to evaluate the row
Use this option if your Excel version supports both IFS and XMATCH.
Evaluate Y and N responses in WPS Spreadsheet
Use COUNTIF and IF in WPS Spreadsheet to return N before Y and leave rows without either value blank.
- 1. Open the workbook: Open WPS Spreadsheet and select Open to choose your Excel workbook.
- 2. Select a result cell: Click H2, or an empty cell outside the range containing the row's responses.
- 3. Enter the formula: In the formula bar, enter =IF(COUNTIF(B2:G2,"N")>0,"N",IF(COUNTIF(B2:G2,"Y")>0,"Y","")) and press Enter. Replace B2:G2 with your input range if needed.
- 4. Fill and save: Drag the fill handle down the result column, then select Menu > Save to save the workbook.

Frequently Asked Questions
What happens if a row contains both Y and N?
The formula returns N because it checks for N before checking for Y.
What does the formula return for a row containing only NA and blanks?
It returns an empty string, so the result cell appears blank. The formula treats NA as text and does not return it as a status.
How do I evaluate a different set of columns?
Replace both instances of B2:G2 in the COUNTIF formula with your row's input range, such as C2:H2, then fill the formula down.
Does NA mean the same thing as the #N/A error?
No. The text NA is a status value, while #N/A is a spreadsheet error. The formulas shown are intended for text values and blank cells.




