Excel find any text in cell

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?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

In this example, the goal is to test a value in a cell to see if it contains a specific substring. Excel contains two functions designed to check the occurrence of one text string inside another: the SEARCH function and the FIND function. Both functions return the position of the substring if found as a number, and a #VALUE! error if the substring is not found. The difference is that the SEARCH function supports wildcards but is not case-sensitive, while the FIND function is case-sensitive but does not support wildcards. The general approach with either function is to use the ISNUMBER function to check for a numeric result (a match) and return TRUE or FALSE.

SEARCH function (not case-sensitive)

The SEARCH function is designed to look inside a text string for a specific substring. If SEARCH finds the substring, it returns a position of the substring in the text as a number. If the substring is not found, SEARCH returns a #VALUE error. For example:

=SEARCH("p","apple") // returns 2
=SEARCH("z","apple") // returns #VALUE!

To force a TRUE or FALSE result, we use the ISNUMBER function. ISNUMBER returns TRUE for numeric values and FALSE for anything else. So, if SEARCH finds the substring, it returns the position as a number, and ISNUMBER returns TRUE:

=ISNUMBER(SEARCH("p","apple")) // returns TRUE
=ISNUMBER(SEARCH("z","apple")) // returns FALSE

If SEARCH doesn’t find the substring, it returns an error, which causes the ISNUMBER to return FALSE.

Wildcards

Although SEARCH is not case-sensitive, it does support wildcards (*?~). For example, the question mark (?) wildcard matches any one character. The formula below looks for a 3-character substring beginning with «x» and ending in «y»:

=ISNUMBER(SEARCH("x?z","xyz")) // TRUE
=ISNUMBER(SEARCH("x?z","xbz")) // TRUE
=ISNUMBER(SEARCH("x?z","xyy")) // FALSE

The asterisk (*) wildcard matches zero or more characters. This wildcard is not as useful in the SEARCH function because SEARCH already looks for a substring. For example, it might seem like the following formula will test for a value that ends with «z»:

=ISNUMBER(SEARCH("*z",text))

However, because SEARCH automatically looks for a substring, the following formulas all return 1 as a result, even though the text in the first formula is the only text that ends with «z»:

=SEARCH("*z","XYZ") // returns 1
=SEARCH("*z","XYZXY") // returns 1
=SEARCH("*z","XYZXY123") // returns 1
=SEARCH("x*z","XYZXY123") // returns 1

This means the asterisk (*) is not a reliable way to test for «ends with». However, you an use the the asterisk (*) wildcard like this: 

=SEARCH("x*2*b","AAAXYZ123ABCZZZ") // returns 4
=SEARCH("x*2*b","NXYZ12563JKLB") // returns 2

Here we are looking for «x», «2», and «b» in that order, with any number of characters in between. Finally, you can use the tilde (~) as an escape character to indicate that the next character is a literal like this:

=SEARCH("~*","apple*") // returns 6
=SEARCH("~?","apple?") // returns 6
=SEARCH("~~","apple~") // returns 6

The above formulas use SEARCH to find a literal asterisk (*), question mark (?) , and tilde (~) in that order.

FIND function (case-sensitive)

Like the SEARCH function, the FIND function returns the position of a substring in text as a number, and an error if the substring is not found. However, unlike the SEARCH function, the FIND function respects case:

=FIND("A","Apple") // returns 1
=FIND("A","apple") // returns #VALUE!

To make a case-sensitive version of the formula, just replace the SEARCH function with the FIND function in the formula above:

=ISNUMBER(FIND(substring,A1))

The result is a case-sensitive search:

=ISNUMBER(FIND("A","Apple")) // returns TRUE
=ISNUMBER(FIND("A","apple")) // returns FALSE

If cell contains

To return a custom result when a cell contains specific text, add the IF function like this:

=IF(ISNUMBER(SEARCH(substring,A1)), "Yes", "No")

Instead of returning TRUE or FALSE, the formula above will return «Yes» if substring is found and «No» if not.

With hardcoded search string

To test for a hardcoded substring, enclose the text in double quotes («»). For example, to check A1 for the text «apple» use:

=ISNUMBER(SEARCH("apple",A1))

More than one search string

To test a cell for more than one thing (i.e. for one of many substrings), see this example formula.

Содержание

  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. Cell contains specific text
  7. Related functions
  8. Summary
  9. Generic formula
  10. Explanation
  11. SEARCH function (not case-sensitive)
  12. Wildcards
  13. FIND function (case-sensitive)
  14. If cell contains
  15. With hardcoded search string
  16. Excel If Cell Contains Text
  17. If Cell Contains Text
  18. If Cell Contains Text Then TRUE
  19. If Cell Contains Partial Text
  20. Find for Case Sensitive Match:
  21. Search for Not Case Sensitive Match:
  22. If Range of Cells Contains Text
  23. If Cells Contains Text From List
  24. If Cell Contains Text Then Return a Value
  25. Excel if cell contains word then assign value
  26. Count If Cell Contains Text
  27. Count If Cell Contains Partial Text
  28. If Cell contains text from list then return value
  29. If Cell Contains Text Then SUM
  30. Sum If Cell Contains Partial Text
  31. VBA to check if Cell Contains Text
  32. If Cell Contains Partial Text VBA
  33. If Cell Contains Text Then VBA MsgBox
  34. Which function returns true if cell a1 contains text?
  35. 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.

Источник

Cell contains specific text

Summary

To check if a cell contains specific text (i.e. a substring), you can use the SEARCH function together with the ISNUMBER function. In the example shown, the formula in D5 is:

This formula returns TRUE if the substring is found, and FALSE if not. Note the SEARCH function is not case-sensitive. See below for a case-sensitive formula.

Generic formula

Explanation

In this example, the goal is to test a value in a cell to see if it contains a specific substring. Excel contains two functions designed to check the occurrence of one text string inside another: the SEARCH function and the FIND function. Both functions return the position of the substring if found as a number, and a #VALUE! error if the substring is not found. The difference is that the SEARCH function supports wildcards but is not case-sensitive, while the FIND function is case-sensitive but does not support wildcards. The general approach with either function is to use the ISNUMBER function to check for a numeric result (a match) and return TRUE or FALSE.

SEARCH function (not case-sensitive)

The SEARCH function is designed to look inside a text string for a specific substring. If SEARCH finds the substring, it returns a position of the substring in the text as a number. If the substring is not found, SEARCH returns a #VALUE error. For example:

To force a TRUE or FALSE result, we use the ISNUMBER function. ISNUMBER returns TRUE for numeric values and FALSE for anything else. So, if SEARCH finds the substring, it returns the position as a number, and ISNUMBER returns TRUE:

If SEARCH doesn’t find the substring, it returns an error, which causes the ISNUMBER to return FALSE.

Wildcards

Although SEARCH is not case-sensitive, it does support wildcards (*?

). For example, the question mark (?) wildcard matches any one character. The formula below looks for a 3-character substring beginning with «x» and ending in «y»:

The asterisk (*) wildcard matches zero or more characters. This wildcard is not as useful in the SEARCH function because SEARCH already looks for a substring. For example, it might seem like the following formula will test for a value that ends with «z»:

However, because SEARCH automatically looks for a substring, the following formulas all return 1 as a result, even though the text in the first formula is the only text that ends with «z»:

This means the asterisk (*) is not a reliable way to test for «ends with». However, you an use the the asterisk (*) wildcard like this:

Here we are looking for «x», «2», and «b» in that order, with any number of characters in between. Finally, you can use the tilde (

) as an escape character to indicate that the next character is a literal like this:

The above formulas use SEARCH to find a literal asterisk (*), question mark (?) , and tilde (

FIND function (case-sensitive)

Like the SEARCH function, the FIND function returns the position of a substring in text as a number, and an error if the substring is not found. However, unlike the SEARCH function, the FIND function respects case:

To make a case-sensitive version of the formula, just replace the SEARCH function with the FIND function in the formula above:

The result is a case-sensitive search:

If cell contains

To return a custom result when a cell contains specific text, add the IF function like this:

Instead of returning TRUE or FALSE, the formula above will return «Yes» if substring is found and «No» if not.

With hardcoded search string

To test for a hardcoded substring, enclose the text in double quotes («»). For example, to check A1 for the text «apple» use:

Источник

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.

Источник

It's gotta be in here somewhere ...
It’s gotta be in here somewhere …

Update: Based on questions I’ve received, I added the Misc Notes section to the end of this post.

Continuing with our #FunctionFriday series, today we’re going to explore how to use the IF, SEARCH, and ISNUMBER functions together to find text (aka a string) inside other text for classification purpose. What Excel really needs is a CONTAINS function, so we don’t have to do these mental acrobats. But, for now, this is what we have to work with.

To illustrate it, I’ll use an example from a chart I include in client dashboards** where they use the AddThis or ShareThis WordPress plugin. The data from these plugins populates to your Google Analytics account. BUT the data is such a red-hot mess, you have to do some cleanup to get it all into nice, neat buckets.

If you’d like to include this report in your own reports, you can use this custom report I created. (If you get a 404 error, it’s because you’re not logged in to Google Analytics. You have to be logged in to apply the report to your Google Analytics profile, aka view.)

**If you want to become a beast at building dashboards using the Google Analytics API, my online course will take you there.

Download Excel Workbook

If you’d like to follow along, you can download the Excel workbook I used in this demo.

The Functions du Jour

IF Function

The IF function is the Swiss Army knife for marketers, especially when you’re building out dynamic dashboards. With the IF function you start with a test — e.g., if A3=B2, if A3>=100, if A3=”organic”, etc. — and then you specify what you want to return if the condition is true and what you want to return if the value is false. But the fun doesn’t stop there; you can actually embed IF functions inside of IF functions. And that’s what we’re going to do in this tutorial.

It follows the following syntax:

IF(logical_test, [value_if_true], [value_if_false])

SEARCH Function

The SEARCH function is a tricky little bugger. It returns the position of whatever character you search for. And if you enter a string of characters, it will return the position of the first character in the matching string. So if you searched for cheese in the string string cheese, it would return the value of 8.

The SEARCH function follows the following syntax:

SEARCH( substring, string, [start_position] )

substring: Pure, unbridled geek speak that means whatever text you’re searching for, e.g., cheese.

string: Typically the cell this text string is in, though you could enter text as long as you flank it with quotation marks. (I almost always use a cell reference.)

start_position: This is optional. I usually only use it when I’m searching for forward slashes in URLs and want to start searching after the http(s)://. You can check out an example in this post that describes how to extract domains from URLs.

Now, if you put a string inside a SEARCH function, it will look for that string exactly. But you can also throw the asterisk wildcard in there for a really good time, which tells Excel to flag any string that even contains the text you’re searching for. So going back to our string cheese example, if I searched for cheese, it would return FALSE; if I searched for *cheese*, it would return TRUE.

ISNUMBER Function

The ISNUMBER function simply tells you if the cell you’re referencing is a value (or number). It’s Boolean, meaning it returns either a value of TRUE or FALSE.

It follows the following syntax:

ISNUMBER(value)

Pro Tip

When dealing with a more complicated IF function, like you’ll see below, a good strategy is to break it into separate lines in the formula bar. To add a line break on a PC, use Alt-Enter; on a Mac, use Control-Option-Enter. I break my IF functions into different lines if I have more than three nested IFs. Here’s what it looks like for the formula we’ll use:

if-function

Click for larger image

If you fat finger something in your formula, it’s really easy to see using this strategy because the IF functions won’t line up. When I’m finished, I just collapse the formula bar back to size by clicking-and-dragging the bottom of it.

Here’s what that same formula would look like if I didn’t use line breaks:

nested IF functions with no line breaks in Excel

Click for larger image

Putting It All Together

Okay, so here’s how we’re going to use them in concert. The Google Analytics custom report we’re using in this demo uses two dimensions: Social Source and Social Action and one metric, Social Actions. It’s a flat report, which, betedubs, is perfect for pivot tables. (Again, you should have data in this report if you use the ShareThis or AddThis plugin on WordPress.) But you could use this same strategy with any marketing data that you have to bucket based on snippets of text inside of strings.

If the formula in cell E4 could talk in plain English (wouldn’t that be nice?), here’s what it would say: “Hey, Excel, check out cell B4. If you see the string facebook anywhere in there, ISNUMBER will return a value of TRUE because you’ll return a number telling me the position of where the string I’m searching for. I don’t actually care about where that string is, only that it returns a number. If it does (IOW, it returns a value of TRUE), return the string Facebook; if it’s false, look for the next sting (i.e., twitter) and return Twitter … Rinse and repeat until you’ve cycled through all of the criteria. And if you don’t find facebook, twitter, email, linkedin, google, stumbleupon, pinterest, or sharethis, just call it Misc.” (Obviously, switch out sharethis for addthis if you’re using that plugin.)

Misc Notes

Difference Between SEARCH and FIND

Someone asked me about using the FIND function on Facebook instead of SEARCH. I rarely use the FIND function because it’s not as flexible as SEARCH. For one, it’s case sensitive. I can only remember one time using it because I needed to differentiate between cases. A much bigger liability is you can’t use it for partial matches because it doesn’t support Excel’s wildcard characters (* and ?).

Extracting Text Instead Of Categorizing It

So what if you didn’t want to match exact or partial text for the purpose of categorizing it like I have in this post with the help of the IF and ISNUMBER functions? What if, instead, you wanted to extract it instead? Then you would use the SEARCH function with the LEFT, RIGHT, and/or MID functions. I demonstrate how to do that in this tutorial on pulling domain names from a list of URLs. (I use this technique in conjunction with pivot tables in just about all competitive analysis I do because it allows me to group backlinks by domain.)

Image credit

~~~

If you would like to learn more about Excel, check out my Excel dashboard course. 24 instructional videos, totaling 6+ hours of instruction for $95.

buy-now-button

Skip to content

Excel Logo

Excel If Cell Contains Text

Excel If Cell Contains Text Then

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.

=IF(ISNUMBER(FIND(“How”,A1,1)),TRUE,FALSE)

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

If Cell Contains Text Then TRUE

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.

=IF(ISERROR(FIND($E$1,A2,1)),”Not Found”,”Found”)

If Cell Contains Partial Text

  • 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(ISERROR(SEARCH($F$1,A2,1)),”Not Found”,”Found”)

If Cell Contains Partial Text 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.

=IF(COUNTIF(A2:A21, “*Region 1d*”)>0,”Range Contais Text”,”Text Not Found in the Given Range”)
  • 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.

If Cell Contains Text Then Return a Value

=IF(ISNUMBER(SEARCH(“How”,A1,1)),”Found”,”Not Found”)

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.

=IFERROR(IF(SEARCH(“Word”,A2,1)>0,1,0),””)

Excel 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.

=COUNTIF($A$2:$A$7,”*”&D2&”*”)

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

If Cell Contains Text Then COUNT

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.

=COUNTIF(A2:A21, “*Region 1*”)
  • 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(OR(COUNTIF(A2,”*”&$D$2:$D$5&”*”)), “Return Value”, “”)

Excel If cell contains text from list then return value

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.

=SUMIF($A$2:$A$7,”*”&D2&”*”,$B$2:$B$7)

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

If Cell Contains Text Then SUM

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(C2:C21,A2:A21, “*Region 1*”)
  • 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.

Sub sbCkeckforPartialText()
MsgBox CheckIfCellContainsPartialText(Cells(2, 1), “Region 1”)
End Sub
Function CheckIfCellContainsPartialText(ByVal cell As Range, ByVal strText As String) As Boolean
If InStr(1, cell.Value, strText) > 0 Then CheckIfCellContainsPartialText = True
End Function
  • 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.

Sub sbVBAIfCellsContainsText()
If InStr(1, Cells(2, 1), “Region 3”) > 0 Then blnMatch = True
If blnMatch = True Then MsgBox “Cell Contains Text”
End Sub
  • 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.

=IF(ISNUMBER(FIND(“YourText”,A1,1)),TRUE,FALSE)

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.

=IF(ISNUMBER(FIND(“YourTextValue”,A1,1)),TRUE,FALSE)

Share This Story, Choose Your Platform!

7 Comments

  1. Meghana
    December 27, 2019 at 1:42 pm — Reply

    Hi Sir,Thank you for the great explanation, covers everything and helps use create formulas if cell contains text values.

    Many thanks! Meghana!!

  2. Max
    December 27, 2019 at 4:44 pm — Reply

    Perfect! Very Simple and Clear explanation. Thanks!!

  3. Mike Song
    August 29, 2022 at 2:45 pm — Reply

    I tried this exact formula and it did not work.

  4. Theresa A Harding
    October 18, 2022 at 9:51 pm — Reply
  5. Marko
    November 3, 2022 at 9:21 pm — Reply

    Hi

    Is possible to sum all WA11?

    (A1) WA11 4

    (A2) AdBlue 1, WA11 223

    (A3) AdBlue 3, WA11 32, shift 4

    … and everything is in one column.

    Thanks you very much for your help.

    Sincerely Marko

  6. Mike
    December 9, 2022 at 9:59 pm — Reply

    Thank you for the help. The formula =OR(COUNTIF(M40,”*”&Vendors&”*”)) will give “TRUE” when some part of M40 contains a vendor from “Vendors” list. But how do I get Excel to tell which vendor it found in the M40 cell?

    • PNRao
      December 18, 2022 at 6:05 am — Reply

      Please describe your question more elaborately.
      Thanks!

© Copyright 2012 – 2020 | Excelx.com | All Rights Reserved

Page load link

Like this post? Please share to your friends:
  • Excel find and replace not in formulas
  • Excel find and replace in one column
  • Excel find and remove
  • Excel find and or function is not found
  • Excel find all duplicates