Function Problems

Excel Formula to Evaluate Y, N, NA, and Blank Cells

Amos GikundaAmos Gikunda Dec 2, 2026 869 views

Question details

Create a row-level result from cells containing Y, N, NA, or blanks, leaving the result blank when the row is empty.

Evaluate Y, N, NA, and Blank Cells in Excel
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.
Before you start

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.

Solution 1Recommended

Use COUNTIF to prioritize N over Y

Use this formula for a straightforward row-level result in Excel.

1
Select the result cell

Click H2, or another empty cell outside the B2:G2 input range.

2
Enter the formula

Type =IF(COUNTIF(B2:G2,"N")>0,"N",IF(COUNTIF(B2:G2,"Y")>0,"Y","")) in the formula bar and press Enter.

3
Apply it to other rows

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 COUNTIF to prioritize N over Y
How the result is chosen: N takes priority over Y. A row containing only NA text and blanks, or no values at all, returns an empty string.
Calculate row results in WPS Spreadsheet

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. 1. Open the workbook: Open WPS Spreadsheet and select Open to choose your Excel workbook.
  2. 2. Select a result cell: Click H2, or an empty cell outside the range containing the row's responses.
  3. 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. 4. Fill and save: Drag the fill handle down the result column, then select Menu > Save to save the workbook.
Apply the same priority formula across multiple rowsOpen and edit Microsoft Excel XLS and XLSX filesUse a familiar spreadsheet interface with common formulas
microsoft office alternative - wps office

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.