Excel if any text in range

Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 Excel 2007 More…Less

Let’s say you want to ensure that a column contains text, not numbers. Or, perhapsyou want to find all orders that correspond to a specific salesperson. If you have no concern for upper- or lowercase text, there are several ways to check if a cell contains text.

You can also use a filter to find text. For more information, see Filter data.

Find cells that contain text

Follow these steps to locate cells containing specific text:

  1. Select the range of cells that you want to search.

    To search the entire worksheet, click any cell.

  2. On the Home tab, in the Editing group, click Find & Select, and then click Find.

    Find option on the ribbon

  3. In the Find what box, enter the text—or numbers—that you need to find. Or, choose a recent search from the Find what drop-down box.

    Note: You can use wildcard characters in your search criteria.

  4. To specify a format for your search, click Format and make your selections in the Find Format popup window.

  5. Click Options to further define your search. For example, you can search for all of the cells that contain the same kind of data, such as formulas.

    In the Within box, you can select Sheet or Workbook to search a worksheet or an entire workbook.

  6. Click Find All or Find Next.

    Find All lists every occurrence of the item that you need to find, and allows you to make a cell active by selecting a specific occurrence. You can sort the results of a Find All search by clicking a header.

Note: To cancel a search in progress, press ESC.

Check if a cell has any text in it

To do this task, use the ISTEXT function.

ISTEXT Examples

Check if a cell matches specific text

Use the IF function to return results for the condition that you specify.

IF Examples

Check if part of a cell matches specific text

To do this task, use the IF, SEARCH, and ISNUMBER functions.

Note: The SEARCH function is case-insensitive.

IF, ISNUMBER and SEARCH examples

Need more help?

Return to Excel Formulas List

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

Содержание

  1. Check if a cell contains text (case-insensitive)
  2. Find cells that contain text
  3. Check if a cell has any text in it
  4. Check if a cell matches specific text
  5. Check if part of a cell matches specific text
  6. Check if any Cell in a Range Contains Text – Excel & Google Sheets
  7. Check if Range Contains Any Text
  8. ISTEXT Function
  9. SUMPRODUCT Function
  10. Google Sheets – Check if any Cell in a Range Contains Text
  11. If cell contains
  12. Related functions
  13. Summary
  14. Generic formula
  15. Explanation
  16. Dave Bruns
  17. Excel If Cell Contains Text
  18. If Cell Contains Text
  19. If Cell Contains Text Then TRUE
  20. If Cell Contains Partial Text
  21. Find for Case Sensitive Match:
  22. Search for Not Case Sensitive Match:
  23. If Range of Cells Contains Text
  24. If Cells Contains Text From List
  25. If Cell Contains Text Then Return a Value
  26. Excel if cell contains word then assign value
  27. Count If Cell Contains Text
  28. Count If Cell Contains Partial Text
  29. If Cell contains text from list then return value
  30. If Cell Contains Text Then SUM
  31. Sum If Cell Contains Partial Text
  32. VBA to check if Cell Contains Text
  33. If Cell Contains Partial Text VBA
  34. If Cell Contains Text Then VBA MsgBox
  35. Which function returns true if cell a1 contains text?
  36. Which function returns true if cell a1 contains text value?

Check if a cell contains text (case-insensitive)

Let’s say you want to ensure that a column contains text, not numbers. Or, perhapsyou want to find all orders that correspond to a specific salesperson. If you have no concern for upper- or lowercase text, there are several ways to check if a cell contains text.

You can also use a filter to find text. For more information, see Filter data.

Find cells that contain text

Follow these steps to locate cells containing specific text:

Select the range of cells that you want to search.

To search the entire worksheet, click any cell.

On the Home tab, in the Editing group, click Find & Select, and then click Find.

In the Find what box, enter the text—or numbers—that you need to find. Or, choose a recent search from the Find what drop-down box.

Note: You can use wildcard characters in your search criteria.

To specify a format for your search, click Format and make your selections in the Find Format popup window.

Click Options to further define your search. For example, you can search for all of the cells that contain the same kind of data, such as formulas.

In the Within box, you can select Sheet or Workbook to search a worksheet or an entire workbook.

Click Find All or Find Next.

Find All lists every occurrence of the item that you need to find, and allows you to make a cell active by selecting a specific occurrence. You can sort the results of a Find All search by clicking a header.

Note: To cancel a search in progress, press ESC.

Check if a cell has any text in it

To do this task, use the ISTEXT function.

Check if a cell matches specific text

Use the IF function to return results for the condition that you specify.

Check if part of a cell matches specific text

To do this task, use the IF, SEARCH, and ISNUMBER functions.

Note: The SEARCH function is case-insensitive.

Источник

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

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.

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.

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:

Now let’s walk through it.

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

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

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.

Источник

If cell contains

Summary

To test for cells that contain certain text, you can use a formula that uses the IF function together with the SEARCH and ISNUMBER functions. In the example shown, the formula in C5 is:

Generic formula

Explanation

One limitation of the IF function is that it does not support wildcards like «?» and «*». This means you can’t use IF by itself to test for text that may appear anywhere in a cell.

One solution is a formula that uses the IF function together with the SEARCH and ISNUMBER functions. In the example shown, we have a list of email addresses, and we want to extract those that contain «abc». In C5, the formula were using is this:

If «abc» is found anywhere in cell B5, IF will return that value. If not, IF will return an empty string («»). In this formula, the logical test is this bit:

This snippet will return TRUE if the the value in B5 contains «abc» and false if not. The logic of ISNUMBER + SEARCH is explained in detail here.

To copy cell the value in B5 when it contains «abc», we provide B5 again for the «value if true» argument. If FALSE, we supply an empty string («») which will display as a blank cell on the worksheet.

Dave Bruns

Hi — I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.

Источник

Excel If Cell Contains Text

Excel If Cell Contains Text Then Formula helps you to return the output when a cell have any text or a specific text. You can check if a cell contains a some string or text and produce something in other cell. For Example you can check if a cell A1 contains text ‘example text’ and print Yes or No in Cell B1. Following are the example Formulas to check if Cell contains text then return some thing in a Cell.

If Cell Contains Text

Here are the Excel formulas to check if Cell contains specific text then return something. This will return if there is any string or any text in given Cell. We can use this simple approach to check if a cell contains text, specific text, string, any text using Excel If formula. We can use equals to operator(=) to compare the strings .

If Cell Contains Text Then TRUE

Following is the Excel formula to return True if a Cell contains Specif Text. You can check a cell if there is given string in the Cell and return True or False.

The formula will return true if it found the match, returns False of no match found.

If Cell Contains Partial Text

We can return Text If Cell Contains Partial Text. We use formula or VBA to Check Partial Text in a Cell.

Find for Case Sensitive Match:

We can check if a Cell Contains Partial Text then return something using Excel Formula. Following is a simple example to find the partial text in a given Cell. We can use if your want to make the criteria case sensitive.

  • Here, Find Function returns the finding position of the given string
  • Use Find function is Case Sensitive
  • IsError Function check if Find Function returns Error, that means, string not found

Search for Not Case Sensitive Match:

We can use Search function to check if Cell Contains Partial Text. Search function useful if you want to make the checking criteria Not Case Sensitive.

If Range of Cells Contains Text

We can check for the strings in a range of cells. Here is the formula to find If Range of Cells Contains Text. We can use Count If Formula to check the excel if range of cells contains specific text and return Text.

  • CountIf function counts the number of cells with given criteria
  • We can use If function to return the required Text
  • Formula displays the Text ‘Range Contains Text” if match found
  • Returns “Text Not Found in the Given Range” if match not found in the specified range

If Cells Contains Text From List

Below formulas returns text If Cells Contains Text from given List. You can use based on your requirement.

VlookUp to Check If Cell Contains Text from a List:
We can use VlookUp function to match the text in the Given list of Cells. And return the corresponding values.

  • Check if a List Contains Text:
    =IF(ISERR(VLOOKUP(F1,A1:B21,2,FALSE)),”False:Not Contains”,”True: Text Found”)
  • Check if a List Contains Text and Return Corresponding Value:
    =VLOOKUP(F1,A1:B21,2,FALSE)
  • Check if a List Contains Partial Text and Return its Value:
    =VLOOKUP(“*”&F1&”*”,A1:B21,2,FALSE)

If Cell Contains Text Then Return a Value

We can return some value if cell contains some string. Here is the the the Excel formula to return a value if a Cell contains Text. You can check a cell if there is given string in the Cell and return some string or value in another column.

The formula will return true if it found the match, returns False of no match found. can

Excel if cell contains word then assign value

You can replace any word in the following formula to check if cell contains word then assign value.


Search function will check for a given word in the required cell and return it’s position. We can use If function to check if the value is greater than 0 and assign a given value (example: 1) in the cell. search function returns #Value if there is no match found in the cell, we can handle this using IFERROR function.

Count If Cell Contains Text

We can check If Cell Contains Text Then COUNT. Here is the Excel formula to Count if a Cell contains Text. You can count the number of cells containing specific text.

The formula will Sum the values in Column B if the cells of Column A contains the given text.

Count If Cell Contains Partial Text

We can count the cells based on partial match criteria. The following Excel formula Counts if a Cell contains Partial Text.

  • We can use the CountIf Function to Count the Cells if they contains given String
  • Wild-card operators helps to make the CountIf to check for the Partial String
  • Put Your Text between two asterisk symbols (*YourText*) to make the criteria to find any where in the given Cell
  • Add Asterisk symbol at end of your text (YourText*) to make the criteria to find your text beginning of given Cell
  • Place Asterisk symbol at beginning of your text (*YourText) to make the criteria to find your text end of given Cell

If Cell contains text from list then return value

Here is the Excel Formula to check if cell contains text from list then return value. We can use COUNTIF and OR function to check the array of values in a Cell and return the given Value. Here is the formula to check the list in range D2:D5 and check in Cell A2 and return value in B2.

If Cell Contains Text Then SUM

Following is the Excel formula to Sum if a Cell contains Text. You can total the cell values if there is given string in the Cell. Here is the example to sum the column B values based on the values in another Column.

The formula will Sum the values in Column B if the cells of Column A contains the given text.

Sum If Cell Contains Partial Text

Use SumIfs function to Sum the cells based on partial match criteria. The following Excel formula Sums the Values if a Cell contains Partial Text.

  • SUMIFS Function will Sum the Given Sum Range
  • We can specify the Criteria Range, and wild-card expression to check for the Partial text
  • Put Your Text between two asterisk symbols (*YourText*) to Sum the Cells if the criteria to find any where in the given Cell
  • Add Asterisk symbol at end of your text (YourText*) to Sum the Cells if the criteria to find your text beginning of given Cell
  • Place Asterisk symbol at beginning of your text (*YourText) to Sum the Cells if criteria to find your text end of given Cell

VBA to check if Cell Contains Text

Here is the VBA function to find If Cells Contains Text using Excel VBA Macros.

If Cell Contains Partial Text VBA

We can use VBA to check if Cell Contains Text and Return Value. Here is the simple VBA code match the partial text. Excel VBA if Cell contains partial text macros helps you to use in your procedures and functions.

  • CheckIfCellContainsPartialText VBA Function returns true if Cell Contains Partial Text
  • inStr Function will return the Match Position in the given string

If Cell Contains Text Then VBA MsgBox

Here is the simple VBA code to display message box if cell contains text. We can use inStr Function to search for the given string. And show the required message to the user.

  • inStr Function will return the Match Position in the given string
  • blnMatch is the Boolean variable becomes True when match string
  • You can display the message to the user if a Range Contains Text

Which function returns true if cell a1 contains text?

You can use the Excel If function and Find function to return TRUE if Cell A1 Contains Text. Here is the formula to return True.

Which function returns true if cell a1 contains text value?

You can use the Excel If function with Find function to return TRUE if a Cell A1 Contains Text Value. Below is the formula to return True based on the text value.

Источник

The COUNTIF function counts cells that meet supplied criteria, and returns a count of occurrences found. If no cells meet criteria, COUNTIF returns zero.

The asterisk (*) is a wildcard for one or more characters. By concatenating asterisks before and after the value in D5, the formula will count the value as a substring. In other words, it will count the value if it appears anywhere inside any cell in the range.

Any positive result means the value was found. By comparing the result with the greater than operator (>) and zero, we force a final result of TRUE or FALSE.

With IF

You can nest this formula inside the IF function as the logical test. For example, to return a final result of «Yes» or «No», you can use IF like this:

=IF(COUNTIF(range,"*"&value&"*"),"Yes","No")

EXPLANATION

This tutorial shows how to test if a range contains a cell with text and return a specified value if the formula tests true or false, by using an Excel formula and VBA.

This tutorial provides one Excel method that can be applied to test if a range contains at least one cell that has only text by using a combination of Excel IF and COUNTIFfunctions. In this example, if the COUNTIF function, with the criteria of «*», returns a value of greater than 0, meaning the range contains cells that only captures text, the test is TRUE and the formula will return a «Contains Text» value. Alternatively, if the COUNTIF function returns a value of 0, meaning the range does not have any cells that only capture text, the test is FALSE and the formula will return a «No Text» value.

This tutorial provides one VBA method that can be applied to test if a range contains at least one cell that has only text by looping through each cell in a selected range and using the IsText function to identify if a cell contains only text. As soon as the it identifies the first cell that contains only text it will return a value of «Contains Text» and exit loop. If the range does not contain any cells that contain only text, after looping through each cell in a range, it will return a value «No Text».

FORMULA
=IF(COUNTIF(range,»*»)>0,value_if_true, value_if_false)

ARGUMENTS
range: The range of cells you want to test if they contain only text.
value_if_true: Value to be returned if the range contains at least one cell that has only text.
value_if_false: Value to be returned if the range does not contain any cells that contain only text.

Понравилась статья? Поделить с друзьями:
  • Excel if any of these values
  • Excel formatting dates in formulas
  • Excel formatting date not changing
  • Excel formatting cells custom
  • Excel formatting all worksheets