Function Problems

Excel Formula to Return Y or N When a Value Matches Options

Camila MilosovichCamila Milosovich Dec 2, 2026 869 views

Question details

Check whether a manually entered value matches any of three option cells and return Y or N.

Return Y or N When a Value Matches Options in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user enters a result and wants to compare it with three options in the same row.
Observed behavior
The formula should return Y when the entered result matches an option and N when it does not.
Before you start

Identify the cells containing the three options and the entered result. The example below uses D4:F4 for the options, G4 for the result, and H4 for the formula.

Solution 1Recommended

Use COUNTIF to Return Y or N for a Matching Value

Use this formula to check whether the value in G4 matches any option in D4:F4.

1
Select the output cell

Click H4, or another empty cell where you want the Y or N result to appear.

2
Enter the formula

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

3
Apply it to other rows

Select H4 and drag its fill handle down to copy the formula to additional rows. The references adjust for each row.

Use COUNTIF to Return Y or N for a Matching Value
Check blank values: If G4 is blank, a blank cell in D4:F4 can count as a match. COUNTIF also treats *, ?, and ~ in criteria as wildcard characters.
Use WPS Spreadsheet

Check Matching Options in WPS Spreadsheet

Use the same IF and COUNTIF formula in WPS Spreadsheet to return Y or N for an entered value.

  1. 1. Open your spreadsheet: Open WPS Spreadsheet and choose Open to select your workbook.
  2. 2. Select an empty cell: Click H4, assuming your options are in D4:F4 and your entered value is in G4.
  3. 3. Enter the formula: Type =IF(COUNTIF(D4:F4,G4)>0,"Y","N") in the formula bar and press Enter.
  4. 4. Fill down: Drag the fill handle from H4 down to apply the formula to the remaining rows.
Check a value against multiple option cells with one formulaOpen and save Microsoft Excel XLSX filesCopy the formula down to check additional rows
microsoft office alternative - wps office

Frequently Asked Questions

How can I keep the result blank until a value is entered?

In H4, use =IF(G4="","",IF(COUNTIF(D4:F4,G4)>0,"Y","N")). This leaves H4 blank when G4 is empty.

Does COUNTIF distinguish between uppercase and lowercase letters?

No. COUNTIF comparisons are not case-sensitive, so an entry such as Yes matches an option written as YES.

Can I check more than three options?

Yes. Expand the range in the formula. For example, use =IF(COUNTIF(D4:H4,I4)>0,"Y","N") to check I4 against five options in D4:H4.

What happens when I copy the formula down?

The relative references change to match each row. For example, the formula copied from H4 to H5 checks G5 against D5:F5.