Function Problems

Excel Formula to Display Y When It Appears in a Range

Steven ParkerSteven Parker Nov 13, 2026 869 views

Question details

Display Y if a cell in P4:X4 contains Y, and otherwise leave the formula cell blank.

Display Y When It Appears in an Excel Range
Product
Microsoft Excel
Device & OS
not provided
Scenario
Check a row of cells for Y and show the result in a separate cell.
Observed behavior
The result should be Y when a match is found and appear blank when there is no match.
Before you start

Decide whether a cell must equal Y or whether Y can appear within longer text. Enter the formula outside P4:X4 to avoid a circular reference.

Solution 1Recommended

Display Y for an Exact Cell Match in Excel

Use this formula when a cell must contain only Y to count as a match.

1
Select a result cell

In Excel, select a cell outside P4:X4, such as Y4.

2
Enter the formula

Type =IF(COUNTIF(P4:X4,"Y")>0,"Y","") and press Enter.

3
Check the result

Enter Y in a cell in P4:X4 to see Y in the result cell. Remove it, or replace it with other text, to see the result appear blank when no other cell matches.

Display Y for an Exact Cell Match in Excel
Case sensitivity: COUNTIF is not case-sensitive, so a cell containing lowercase y also matches.
WPS Spreadsheet

Check a Range for Y in WPS Spreadsheet

Use the same IF and COUNTIF formulas in WPS Spreadsheet to display Y for a matching cell or show a blank when no match is found.

  1. 1. Open your spreadsheet: Open WPS Spreadsheet and use Open to select your workbook.
  2. 2. Choose a result cell: Select a cell outside P4:X4, such as Y4.
  3. 3. Enter the formula: Type =IF(COUNTIF(P4:X4,"Y")>0,"Y","") and press Enter. For a partial match, replace "Y" inside COUNTIF with "*Y*".
  4. 4. Save the workbook: Use File > Save to keep the formula in your workbook.
Check a range for exact or partial text matchesOpen and edit Microsoft Excel XLSX filesUse familiar spreadsheet formulas and cell referencesWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Does the exact-match formula recognize lowercase y?

Yes. COUNTIF is not case-sensitive, so =IF(COUNTIF(P4:X4,"Y")>0,"Y","") matches both Y and y.

How do I match Y inside a longer word?

Use =IF(COUNTIF(P4:X4,"*Y*")>0,"Y",""). The asterisks allow text before or after Y.

Why does the formula show Y when a cell contains Yes?

The wildcard criterion "*Y*" matches Y anywhere in the text. Use the exact criterion "Y" instead if the entire cell must equal Y.

Is the result cell truly empty when there is no match?

No. The IF formula returns an empty text string ("") when there is no match, so the cell appears blank but still contains a formula.