Function Problems

Return Yes or No If an Excel Range Contains Data

Chanuka GeekiyanageChanuka Geekiyanage Nov 18, 2026 869 views

Question details

Return a single Yes or No result depending on whether an Excel range contains any data.

Return Yes or No If an Excel Range Contains Data
Product
Microsoft Excel
Device & OS
not provided
Scenario
Check cells G4 through G12 on the Product Ideas worksheet without counting a specific word.
Observed behavior
The desired result is Yes when at least one cell contains data and No when the range is empty.
Before you start

Confirm the worksheet name and range you want to check, and choose a result cell outside that range. The example uses G4:G12 on a sheet named Product Ideas.

Solution 1Recommended

Use IF and COUNTA to Check the Excel Range

Use this formula to return Yes for any nonblank value and No for an empty range.

1
Select a result cell

In Excel, click an empty cell outside the range you want to check.

2
Enter the formula

Type =IF(COUNTA('Product Ideas'!G4:G12)>0,"Yes","No") in the cell or formula bar, then press Enter.

3
Adjust the reference

If needed, edit 'Product Ideas'!G4:G12 in the formula to match your worksheet name and range. Keep single quotation marks around sheet names containing spaces.

Use IF and COUNTA to Check the Excel Range
What COUNTA counts: COUNTA counts text, numbers, errors, and other values. It also counts spaces and formulas that return an empty string, even if a cell looks blank.
Check ranges in WPS Spreadsheets

Return Yes or No for a Range in WPS Spreadsheets

Use the same IF and COUNTA formula in WPS Spreadsheets to check a range and display a single Yes or No result.

  1. 1. Open your workbook: Launch WPS Spreadsheets and use Open to select your workbook.
  2. 2. Choose a result cell: Click an empty cell outside the range you want to check.
  3. 3. Enter the formula: Type =IF(COUNTA('Product Ideas'!G4:G12)>0,"Yes","No") and press Enter. Replace the sheet name and range as needed.
  4. 4. Save the workbook: Use File > Save or Save As to keep the formula in your workbook.
Check a range for data without counting a specific word.Open and save Microsoft Excel XLSX files.Use familiar spreadsheet formulas and worksheet references.
microsoft office alternative - wps office

Frequently Asked Questions

Does the formula check for text only?

No. COUNTA checks for nonblank values, including numbers, text, errors, and formulas returning an empty string.

How do I check a range on the same worksheet?

Omit the sheet name from the reference. For example, enter =IF(COUNTA(G4:G12)>0,"Yes","No") in a cell outside G4:G12.

Why does the formula return Yes when the cells look empty?

A cell may contain spaces or a formula that returns an empty string. Select cells in the range and inspect their contents in the formula bar.

What if Excel does not accept the formula?

Check the sheet name and range, and make sure sheet names with spaces are enclosed in single quotation marks. Depending on your regional settings, you may also need to replace the commas between arguments with semicolons.