Check if any Cell in a Range Contains Text – Excel & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on February 6, 2023
Download Example Workbook

Download the example workbook

This tutorial will demonstrate how to check if any cell in a range contains any text in Excel and Google Sheets.

range contains any text

 

Check if Range Contains Any Text

To test if any cell in a range contains any text, we will use the ISTEXT and SUMPRODUCT Functions.

ISTEXT Function

The ISTEXT Function does exactly what its name implies. It tests if a cell is text, outputting TRUE or FALSE.

=ISTEXT(A2)

ISTEXT

SUMPRODUCT Function

The ISTEXT Function only tests a single cell, so we must find a way to test the entire range. This is where the SUMPRODUCT Function comes in. The SUMPRODUCT Function sums together arrays of values. So if we test each cell individually, outputting a 1 (TRUE) or 0 (FALSE) if each cell as text, then we can sum the values together. If the sum is greater than 0 than we know at least one cell contained text.

First, here is the final calculation:

=SUMPRODUCT(--ISTEXT(A2:C2))>0

Sumproduct

Now let’s walk through it.

=SUMPRODUCT(--ISTEXT(A2:C2))>0
=SUMPRODUCT(--{FALSE TRUE, TRUE})>0
=SUMPRODUCT({0, 1, 1})>0
=2>0
=TRUE

Note: the double negatives converts the TRUE/FALSE into 1 / 0. Alternatively you could multiply the ISTEXT Function by *1

=SUMPRODUCT(ISTEXT(A2:C2)*1)>0

Sumproduct Multiply One

Instead of outputting TRUE / FALSE, you can use an IF Statement to output other text or calculations:

=IF(SUMPRODUCT(--ISTEXT(A2:C2))>0, "Yes", "No")

Sumproduct IF

Google Sheets – Check if any Cell in a Range Contains Text

All of the above examples work exactly the same in Google Sheets as in Excel.

Google Sheet

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to Excel Formulas List