If function excel any text

IF function

The IF function is one of the most popular functions in Excel, and it allows you to make logical comparisons between a value and what you expect.

So an IF statement can have two results. The first result is if your comparison is True, the second if your comparison is False.

For example, =IF(C2=”Yes”,1,2) says IF(C2 = Yes, then return a 1, otherwise return a 2).

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it’s false.

IF(logical_test, value_if_true, [value_if_false])

For example:

  • =IF(A2>B2,»Over Budget»,»OK»)

  • =IF(A2=B2,B4-A4,»»)

Argument name

Description

logical_test    (required)

The condition you want to test.

value_if_true    (required)

The value that you want returned if the result of logical_test is TRUE.

value_if_false    (optional)

The value that you want returned if the result of logical_test is FALSE.

Simple IF examples

Cell D2 contains a formula =IF(C2="Yes",1,2)

  • =IF(C2=”Yes”,1,2)

In the above example, cell D2 says: IF(C2 = Yes, then return a 1, otherwise return a 2)

Cell D2 contains the formula =IF(C2=1,"YES","NO")

  • =IF(C2=1,”Yes”,”No”)

In this example, the formula in cell D2 says: IF(C2 = 1, then return Yes, otherwise return No)As you see, the IF function can be used to evaluate both text and values. It can also be used to evaluate errors. You are not limited to only checking if one thing is equal to another and returning a single result, you can also use mathematical operators and perform additional calculations depending on your criteria. You can also nest multiple IF functions together in order to perform multiple comparisons.

Formula in cell D2 is =IF(C2>B2,”Over Budget”,”Within Budget”)

  • =IF(C2>B2,”Over Budget”,”Within Budget”)

In the above example, the IF function in D2 is saying IF(C2 Is Greater Than B2, then return “Over Budget”, otherwise return “Within Budget”)

Formula in cell E2 is =IF(C2>B2,C2-B2,"")

  • =IF(C2>B2,C2-B2,0)

In the above illustration, instead of returning a text result, we are going to return a mathematical calculation. So the formula in E2 is saying IF(Actual is Greater than Budgeted, then Subtract the Budgeted amount from the Actual amount, otherwise return nothing).

Formula in Cell F7 is IF(E7=”Yes”,F5*0.0825,0)

  • =IF(E7=”Yes”,F5*0.0825,0)

In this example, the formula in F7 is saying IF(E7 = “Yes”, then calculate the Total Amount in F5 * 8.25%, otherwise no Sales Tax is due so return 0)

Note: If you are going to use text in formulas, you need to wrap the text in quotes (e.g. “Text”). The only exception to that is using TRUE or FALSE, which Excel automatically understands.

Common problems

Problem

What went wrong

0 (zero) in cell

There was no argument for either value_if_true or value_if_False arguments. To see the right value returned, add argument text to the two arguments, or add TRUE or FALSE to the argument.

#NAME? in cell

This usually means that the formula is misspelled.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Connect with an expert. Learn from live instructors.

See Also

IF function — nested formulas and avoiding pitfalls

IFS function

Using IF with AND, OR and NOT functions

COUNTIF function

How to avoid broken formulas

Overview of formulas in Excel

Need more help?

Normally, If you want to write an IF formula for text values in combining with the below two logical operators in excel, such as: “equal to” or “not equal to”.

Table of Contents

  • Excel IF function check if a cell contains text(case-insensitive)
  • Excel IF function check if a cell contains text (case-sensitive)
  • Excel IF function check if part of cell matches specific text
  •  Excel IF function with Wildcards text value
    • Related Formulas
    • Related Functions

Excel IF function check if a cell contains text(case-insensitive)

By default, IF function is case-insensitive in excel. It means that the logical text for text values will do not recognize case in the IF formulas. For example, the following two IF formulas will get the same results when checking the text values in cells.

=IF(B1="excel","yes","no")
=IF(B1="EXCEl","yes","no")

The IF formula will check the values of cell B1 if it is equal to “excel” word, If it is TRUE, then return “yes”, otherwise return “no”. And the logical test in the above IF formula will check the text values in the logical_test argument, whatever the logical_test values are “Excel”, “eXcel”, or “EXCEL”, the IF formula don’t care about that if the text values is in lowercase or uppercase, It will get the same results at last.

Excel IF function check if a cell contains text1

Excel IF function check if a cell contains text1

Excel IF function check if a cell contains text (case-sensitive)

If you want to check text values in cells using IF formula in excel (case-sensitive), then you need to create a case-sensitive logical test and then you can use IF function in combination with EXACT function to compare two text values. So if those two text values are exactly the same, then return TRUE. Otherwise return FALSE.

So we can write down the following IF formula combining with EXACT function:

=IF(EXACT(B1,"excel"),"yes","no")

Excel IF function check if a cell contains text case-sensitive1

Excel IF function check if part of cell matches specific text

If you want to check if part of text values in cell matches the specific text rather than exact match, to achieve this logic text, you can use IF function in combination with ISNUMBER and SEARCH Function in excel.

Both ISNUMBER and SEARCH functions are case-insensitive in excel.

=IF(ISNUMBER(SEARCH("x",B1)),"good","bad")

Excel IF function check if part of cell matches specific text1

For above the IF formula, it will Check to see if B1 contain the letter x.

Also, we can use FIND function to replace the SEARCH function in the above IF formula. It will return the same results.

 Excel IF function with Wildcards text value

If you wan to use wildcard charcter in an IF formula, for example, if any of the values in column B contains “*xc*”, then return “good”, others return “bad”. You can not directly use the wildcard characters in IF formula, and we can use IF function in combination with COUNTIF function. Let’s see the following IF formula:

=IF(COUNTIF(B1:B4,"*xc*"), "good","bad")

Excel IF function with Wildcards text value1


  • Excel IF Function With Numbers
    If you want to check if a cell values is between two values or checking for the range of numbers or multiple values in cells, at this time, we need to use AND or OR logical function in combination with the logical operator and IF function…

  • Excel EXACT function
    The Excel SEARCH function returns the number of the starting location of a substring in a text string.The syntax of the EXACT function is as below:= EXACT (text1,text2)…
  • Excel COUNTIF function
    The Excel COUNTIF function will count the number of cells in a range that meet a given criteria.= COUNTIF (range, criteria) …
  • Excel ISNUMBER function
    The Excel ISNUMBER function returns TRUE if the value in a cell is a numeric value, otherwise it will return FALSE.
  • Excel IF function
    The Excel IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE….
  • Excel SEARCH function
    The Excel SEARCH function returns the number of the starting location of a substring in a text string.…

Содержание

  1. IF function
  2. Simple IF examples
  3. Common problems
  4. Need more help?
  5. How To Use “If Cell Contains” Formulas in Excel
  6. Excel Formula: If cell contains
  7. Explanation: If Cell Contains
  8. Using “if cell contains” formulas in Excel
  9. 1. If cell contains any value, then return a value
  10. 2. If cell contains text/number, then return a value
  11. Check for text
  12. Check for a number or date
  13. 3. If cell contains specific text, then return a value
  14. 4. If cell contains specific text, then return a value (case-sensitive)
  15. 5. If cell does not contain specific text, then return a value
  16. 6. If cell contains one of many text strings, then return a value
  17. 7. If cell contains several of many text strings, then return a value
  18. Final thoughts
  19. Before you go
  20. Excel IF function with text values
  21. Excel IF function check if a cell contains text(case-insensitive)
  22. Excel IF function check if a cell contains text (case-sensitive)
  23. Excel IF function check if part of cell matches specific text
  24. Excel IF function with Wildcards text value

IF function

The IF function is one of the most popular functions in Excel, and it allows you to make logical comparisons between a value and what you expect.

So an IF statement can have two results. The first result is if your comparison is True, the second if your comparison is False.

For example, =IF(C2=”Yes”,1,2) says IF(C2 = Yes, then return a 1, otherwise return a 2).

Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it’s false.

IF(logical_test, value_if_true, [value_if_false])

The condition you want to test.

The value that you want returned if the result of logical_test is TRUE.

The value that you want returned if the result of logical_test is FALSE.

Simple IF examples

In the above example, cell D2 says: IF(C2 = Yes, then return a 1, otherwise return a 2)

In this example, the formula in cell D2 says: IF(C2 = 1, then return Yes, otherwise return No)As you see, the IF function can be used to evaluate both text and values. It can also be used to evaluate errors. You are not limited to only checking if one thing is equal to another and returning a single result, you can also use mathematical operators and perform additional calculations depending on your criteria. You can also nest multiple IF functions together in order to perform multiple comparisons.

B2,”Over Budget”,”Within Budget”)» loading=»lazy»>

=IF(C2>B2,”Over Budget”,”Within Budget”)

In the above example, the IF function in D2 is saying IF(C2 Is Greater Than B2, then return “Over Budget”, otherwise return “Within Budget”)

B2,C2-B2,»»)» loading=»lazy»>

In the above illustration, instead of returning a text result, we are going to return a mathematical calculation. So the formula in E2 is saying IF(Actual is Greater than Budgeted, then Subtract the Budgeted amount from the Actual amount, otherwise return nothing).

In this example, the formula in F7 is saying IF(E7 = “Yes”, then calculate the Total Amount in F5 * 8.25%, otherwise no Sales Tax is due so return 0)

Note: If you are going to use text in formulas, you need to wrap the text in quotes (e.g. “Text”). The only exception to that is using TRUE or FALSE, which Excel automatically understands.

Common problems

What went wrong

There was no argument for either value_if_true or value_if_False arguments. To see the right value returned, add argument text to the two arguments, or add TRUE or FALSE to the argument.

This usually means that the formula is misspelled.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Источник

How To Use “If Cell Contains” Formulas in Excel

Excel has a number of formulas that help you use your data in useful ways. For example, you can get an output based on whether or not a cell meets certain specifications. Right now, we’ll focus on a function called “if cell contains, then”. Let’s look at an example.

Excel Formula: If cell contains

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:

If you want to check whether or not the A1 cell contains the text “Example”, you can run a formula that will output “Yes” or “No” in the B1 cell. There are a number of different ways you can put these formulas to use. At the time of writing, Excel is able to return the following variations:

  • If cell contains any value
  • If cell contains text
  • If cell contains number
  • If cell contains specific text
  • If cell contains certain text string
  • If cell contains one of many text strings
  • If cell contains several strings

Using these scenarios, you’re able to check if a cell contains text, value, and more.

Explanation: If Cell Contains

One limitation of the IF function is that it does not support Excel wildcards like «?» and «*». This simply 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. For example, if you have a list of email addresses, and want to extract those that contain «ABC», the formula to use is this:

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

Using “if cell contains” formulas in Excel

The guides below were written using the latest Microsoft Excel 2019 for Windows 10 . Some steps may vary if you’re using a different version or platform. Contact our experts if you need any further assistance.

1. If cell contains any value, then return a value

This scenario allows you to return values based on whether or not a cell contains any value at all. For example, we’ll be checking whether or not the A1 cell is blank or not, and then return a value depending on the result.

  1. Select the output cell, and use the following formula: =IF(cell<>«», value_to_return, «») .
  2. For our example, the cell we want to check is A2 , and the return value will be No . In this scenario, you’d change the formula to =IF(A2<>«», «No», «») .
  • Since the A2 cell isn’t blank, the formula will return “ No ” in the output cell. If the cell you’re checking is blank, the output cell will also remain blank.
  • 2. If cell contains text/number, then return a value

    With the formula below, you can return a specific value if the target cell contains any text or number. The formula will ignore the opposite data types.

    Check for text

    1. To check if a cell contains text, select the output cell, and use the following formula: =IF(ISTEXT(cell), value_to_return, «») .
    2. For our example, the cell we want to check is A2 , and the return value will be Yes . In this scenario, you’d change the formula to =IF(ISTEXT(A2), «Yes», «») .
    3. Because the A2 cell does contain text and not a number or date, the formula will return “ Yes ” into the output cell.

    Check for a number or date

    1. To check if a cell contains a number or date, select the output cell, and use the following formula: =IF(ISNUMBER(cell), value_to_return, «») .
    2. For our example, the cell we want to check is D2 , and the return value will be Yes . In this scenario, you’d change the formula to =IF(ISNUMBER(D2), «Yes», «») .
    3. Because the D2 cell does contain a number and not text, the formula will return “ Yes ” into the output cell.

    3. If cell contains specific text, then return a value

    To find a cell that contains specific text, use the formula below.

    1. Select the output cell, and use the following formula: =IF(cell=»text», value_to_return, «») .
    2. For our example, the cell we want to check is A2 , the text we’re looking for is “ example ”, and the return value will be Yes . In this scenario, you’d change the formula to =IF(A2=»example», «Yes», «») .
    3. Because the A2 cell does consist of the text “ example ”, the formula will return “ Yes ” into the output cell.

    4. If cell contains specific text, then return a value (case-sensitive)

    To find a cell that contains specific text, use the formula below. This version is case-sensitive, meaning that only cells with an exact match will return the specified value.

    1. Select the output cell, and use the following formula: =IF(EXACT(cell,»case_sensitive_text»), «value_to_return», «») .
    2. For our example, the cell we want to check is A2 , the text we’re looking for is “ EXAMPLE ”, and the return value will be Yes . In this scenario, you’d change the formula to =IF(EXACT(A2,»EXAMPLE»), «Yes», «») .
    3. Because the A2 cell does consist of the text “ EXAMPLE ” with the matching case, the formula will return “ Yes ” into the output cell.

    5. If cell does not contain specific text, then return a value

    The opposite version of the previous section. If you want to find cells that don’t contain a specific text, use this formula.

    1. Select the output cell, and use the following formula: =IF(cell=»text», «», «value_to_return») .
    2. For our example, the cell we want to check is A2 , the text we’re looking for is “ example ”, and the return value will be No . In this scenario, you’d change the formula to =IF(A2=»example», «», «No») .
    3. Because the A2 cell does consist of the text “ example ”, the formula will return a blank cell. On the other hand, other cells return “ No ” into the output cell.

    6. If cell contains one of many text strings, then return a value

    This formula should be used if you’re looking to identify cells that contain at least one of many words you’re searching for.

    1. Select the output cell, and use the following formula: =IF(OR(ISNUMBER(SEARCH(«string1», cell)), ISNUMBER(SEARCH(«string2», cell))), value_to_return, «») .
    2. For our example, the cell we want to check is A2 . We’re looking for either “ tshirt ” or “ hoodie ”, and the return value will be Valid . In this scenario, you’d change the formula to =IF(OR(ISNUMBER(SEARCH(«tshirt»,A2)),ISNUMBER(SEARCH(«hoodie»,A2))),»Valid «,»») .
    3. Because the A2 cell does contain one of the text values we searched for, the formula will return “ Valid ” into the output cell.

    To extend the formula to more search terms, simply modify it by adding more strings using ISNUMBER(SEARCH(«string», cell)) .

    7. If cell contains several of many text strings, then return a value

    This formula should be used if you’re looking to identify cells that contain several of the many words you’re searching for. For example, if you’re searching for two terms, the cell needs to contain both of them in order to be validated.

    1. Select the output cell, and use the following formula: =IF(AND(ISNUMBER(SEARCH(«string1»,cell)), ISNUMBER(SEARCH(«string2″,cell))), value_to_return,»») .
    2. For our example, the cell we want to check is A2 . We’re looking for “ hoodie ” and “ black ”, and the return value will be Valid . In this scenario, you’d change the formula to =IF(AND(ISNUMBER(SEARCH(«hoodie»,A2)),ISNUMBER(SEARCH(«black»,A2))),»Valid «,»») .
    3. Because the A2 cell does contain both of the text values we searched for, the formula will return “ Valid ” to the output cell.

    Final thoughts

    We hope this article was useful to you in learning how to use “if cell contains” formulas in Microsoft Excel. Now, you can check if any cells contain values, text, numbers, and more. This allows you to navigate, manipulate and analyze your data efficiently.

    We’re glad you’re read the article up to here 🙂 Thank you 🙂

    Please share it on your socials. Someone else will benefit.

    Before you go

    If you need any further help with Excel, don’t hesitate to reach out to our customer service team, which is available 24/7 to assist you. Return to us for more informative articles all related to productivity and modern-day technology!

    Would you like to receive promotions, deals, and discounts to get our products for the best price? Don’t forget to subscribe to our newsletter by entering your email address below! Receive the latest technology news in your inbox and be the first to read our tips to become more productive.

    Источник

    Excel IF function with text values

    Normally, If you want to write an IF formula for text values in combining with the below two logical operators in excel, such as: “equal to” or “not equal to”.

    Excel IF function check if a cell contains text(case-insensitive)

    By default, IF function is case-insensitive in excel. It means that the logical text for text values will do not recognize case in the IF formulas. For example, the following two IF formulas will get the same results when checking the text values in cells.

    The IF formula will check the values of cell B1 if it is equal to “excel” word, If it is TRUE, then return “yes”, otherwise return “no”. And the logical test in the above IF formula will check the text values in the logical_test argument, whatever the logical_test values are “Excel”, “eXcel”, or “EXCEL”, the IF formula don’t care about that if the text values is in lowercase or uppercase, It will get the same results at last.

    Excel IF function check if a cell contains text (case-sensitive)

    If you want to check text values in cells using IF formula in excel (case-sensitive), then you need to create a case-sensitive logical test and then you can use IF function in combination with EXACT function to compare two text values. So if those two text values are exactly the same, then return TRUE. Otherwise return FALSE.

    So we can write down the following IF formula combining with EXACT function:

    Excel IF function check if part of cell matches specific text

    If you want to check if part of text values in cell matches the specific text rather than exact match, to achieve this logic text, you can use IF function in combination with ISNUMBER and SEARCH Function in excel.

    Both ISNUMBER and SEARCH functions are case-insensitive in excel.

    For above the IF formula, it will Check to see if B1 contain the letter x.

    Also, we can use FIND function to replace the SEARCH function in the above IF formula. It will return the same results.

    Excel IF function with Wildcards text value

    If you wan to use wildcard charcter in an IF formula, for example, if any of the values in column B contains “*xc*”, then return “good”, others return “bad”. You can not directly use the wildcard characters in IF formula, and we can use IF function in combination with COUNTIF function. Let’s see the following IF formula:

    Источник

    Excel has a number of formulas that help you use your data in useful ways. For example, you can get an output based on whether or not a cell meets certain specifications. Right now, we’ll focus on a function called “if cell contains, then”. Let’s look at an example.

    Jump To Specific Section:

    1. Explanation: If Cell Contains
    2. If cell contains any value, then return a value
    3. If cell contains text/number, then return a value
    4. If cell contains specific text, then return a value
    5. If cell contains specific text, then return a value (case-sensitive)
    6. If cell does not contain specific text, then return a value
    7. If cell contains one of many text strings, then return a value
    8. If cell contains several of many text strings, then return a value

    Excel Formula: If cell contains

    Generic formula 

    =IF(ISNUMBER(SEARCH("abc",A1)),A1,"")

    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:

    =IF(ISNUMBER(SEARCH("abc",B5)),B5,"")

    If you want to check whether or not the A1 cell contains the text “Example”, you can run a formula that will output “Yes” or “No” in the B1 cell. There are a number of different ways you can put these formulas to use. At the time of writing, Excel is able to return the following variations:

    • If cell contains any value
    • If cell contains text
    • If cell contains number
    • If cell contains specific text
    • If cell contains certain text string
    • If cell contains one of many text strings
    • If cell contains several strings

    Using these scenarios, you’re able to check if a cell contains text, value, and more. 

    Explanation: If Cell Contains

    One limitation of the IF function is that it does not support Excel wildcards like «?» and «*». This simply 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. For example, if you have a list of email addresses, and want to extract those that contain «ABC», the formula to use is this:

    =IF(ISNUMBER(SEARCH("abc",B5)),B5,""). Assuming cells run to B5

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

    ISNUMBER(SEARCH("abc",B5))


    Read article: Excel efficiency: 11 Excel Formulas To Increase Your Productivity

    Using “if cell contains” formulas in Excel

    The guides below were written using the latest Microsoft Excel 2019 for Windows 10. Some steps may vary if you’re using a different version or platform. Contact our experts if you need any further assistance.

    1. If cell contains any value, then return a value

    This scenario allows you to return values based on whether or not a cell contains any value at all. For example, we’ll be checking whether or not the A1 cell is blank or not, and then return a value depending on the result.

    • Select the output cell, and use the following formula: =IF(cell<>»», value_to_return, «»).
    • For our example, the cell we want to check is A2, and the return value will be No. In this scenario, you’d change the formula to =IF(A2<>»», «No», «»)
    • Since the A2 cell isn’t blank, the formula will return “No” in the output cell. If the cell you’re checking is blank, the output cell will also remain blank.

    2. If cell contains text/number, then return a value

    With the formula below, you can return a specific value if the target cell contains any text or number. The formula will ignore the opposite data types.

    Check for text

    • To check if a cell contains text, select the output cell, and use the following formula: =IF(ISTEXT(cell), value_to_return, «»).
    • For our example, the cell we want to check is A2, and the return value will be Yes. In this scenario, you’d change the formula to =IF(ISTEXT(A2), «Yes», «»)
      check for txt
    • Because the A2 cell does contain text and not a number or date, the formula will return “Yes” into the output cell.

    Check for a number or date

    • To check if a cell contains a number or date, select the output cell, and use the following formula: =IF(ISNUMBER(cell), value_to_return, «»).
    • For our example, the cell we want to check is D2, and the return value will be Yes. In this scenario, you’d change the formula to =IF(ISNUMBER(D2), «Yes», «»)
      check for number or date
    • Because the D2 cell does contain a number and not text, the formula will return “Yes” into the output cell.

    3. If cell contains specific text, then return a value

    To find a cell that contains specific text, use the formula below.

    • Select the output cell, and use the following formula: =IF(cell=»text», value_to_return, «»).
    • For our example, the cell we want to check is A2, the text we’re looking for is “example”, and the return value will be Yes. In this scenario, you’d change the formula to =IF(A2=»example», «Yes», «»)
      If cell contains specific text, then return a value
    • Because the A2 cell does consist of the text “example”, the formula will return “Yes” into the output cell.

    4. If cell contains specific text, then return a value (case-sensitive)

    To find a cell that contains specific text, use the formula below. This version is case-sensitive, meaning that only cells with an exact match will return the specified value.

    • Select the output cell, and use the following formula: =IF(EXACT(cell,»case_sensitive_text»), «value_to_return», «»).
    • For our example, the cell we want to check is A2, the text we’re looking for is “EXAMPLE”, and the return value will be Yes. In this scenario, you’d change the formula to =IF(EXACT(A2,»EXAMPLE»), «Yes», «»).
    • Because the A2 cell does consist of the text “EXAMPLE” with the matching case, the formula will return “Yes” into the output cell.

    5. If cell does not contain specific text, then return a value

    The opposite version of the previous section. If you want to find cells that don’t contain a specific text, use this formula.

    • Select the output cell, and use the following formula: =IF(cell=»text», «», «value_to_return»).
    • For our example, the cell we want to check is A2, the text we’re looking for is “example”, and the return value will be No. In this scenario, you’d change the formula to =IF(A2=»example», «», «No»).
      If cell contains specific text, then return a value (case-sensitive)
    • Because the A2 cell does consist of the text “example”, the formula will return a blank cell. On the other hand, other cells return “No” into the output cell.

    6. If cell contains one of many text strings, then return a value

    This formula should be used if you’re looking to identify cells that contain at least one of many words you’re searching for.

    • Select the output cell, and use the following formula: =IF(OR(ISNUMBER(SEARCH(«string1», cell)), ISNUMBER(SEARCH(«string2», cell))), value_to_return, «»).
    • For our example, the cell we want to check is A2. We’re looking for either “tshirt” or “hoodie”, and the return value will be Valid. In this scenario, you’d change the formula to =IF(OR(ISNUMBER(SEARCH(«tshirt»,A2)),ISNUMBER(SEARCH(«hoodie»,A2))),»Valid «,»»).
      =IF(OR(ISNUMBER(SEARCH("tshirt",A2)),ISNUMBER(SEARCH("hoodie",A2))),"Valid ","").
    • Because the A2 cell does contain one of the text values we searched for, the formula will return “Valid” into the output cell.

    To extend the formula to more search terms, simply modify it by adding more strings using ISNUMBER(SEARCH(«string», cell)).

    7. If cell contains several of many text strings, then return a value

    This formula should be used if you’re looking to identify cells that contain several of the many words you’re searching for. For example, if you’re searching for two terms, the cell needs to contain both of them in order to be validated.

    • Select the output cell, and use the following formula: =IF(AND(ISNUMBER(SEARCH(«string1»,cell)), ISNUMBER(SEARCH(«string2″,cell))), value_to_return,»»).
    • For our example, the cell we want to check is A2. We’re looking for “hoodie” and “black”, and the return value will be Valid. In this scenario, you’d change the formula to =IF(AND(ISNUMBER(SEARCH(«hoodie»,A2)),ISNUMBER(SEARCH(«black»,A2))),»Valid «,»»).
      =IF(AND(ISNUMBER(SEARCH("hoodie",A2)),ISNUMBER(SEARCH("black",A2))),"Valid ","").
    • Because the A2 cell does contain both of the text values we searched for, the formula will return “Valid” to the output cell.

    Final thoughts

    We hope this article was useful to you in learning how to use “if cell contains” formulas in Microsoft Excel. Now, you can check if any cells contain values, text, numbers, and more. This allows you to navigate, manipulate and analyze your data efficiently.

    We’re glad you’re read the article up to here :) Thank you :)

    You may also like

    » How to use NPER Function in Excel
    » How to Separate First and Last Name in Excel
    » How to Calculate Break-Even Analysis in Excel

    Author: Oscar Cronquist Article last updated on April 11, 2018

    The picture above shows different values in column B and a formula in column C that tries to identifies the value in column B.

    Formula in cell C3:

    =IF(ISTEXT(B3),»Text»,»Not text»)

    The formula above checks if a cell contains a text value based on whether Excel correctly identified and formatted the cell as a text value or not.

    This works often quite well, however, sometimes numbers are formatted as text.

    This can happen if you import data from a database, copy and paste values from the web or a formula that returns numbers that Excel handles as a text string, among other things.

    For example, cell B10 has a number formatted as a text value and the ISTEXT function incorrectly identifies the number as a text value.

    The following formula will correctly identify numbers even if Excel identifies the number as a text value.

    Formula in cell C3:

    =IF(ISTEXT(B3)*NOT(ISNUMBER(B3*1)),»Text»,»Not text»)

    Explaining formula in cell C10

    The formula in cell C10 is

    =IF(ISTEXT(B10)*NOT(ISNUMBER(B10*1)),»Text»,»Not text»)

    B10*1 returns a number if B10 contains a number and an error for anything else.

    13*1 = 13

    ISNUMBER(B10*1) returns TRUE if the argument is a number and FALSE for all else.

    ISNUMBER(B10*1) returns TRUE.

    The NOT function returns TRUE if FALSE and FALSE if TRUE.

    NOT(ISNUMBER(B10*1))

    becomes

    NOT(TRUE) and returns FALSE.

    The ISTEXT function returns TRUE for all text values.

    ISTEXT(B10) returns TRUE.

    Multiplying the two functions is the same as AND logic. I could use the AND function, however, the * (asterisk) is smaller.

    ISTEXT(B10)*NOT(ISNUMBER(B10*1))

    becomes

    TRUE*FALSE and returns 0. 1*0 = 0

    The IF function then returns the third argument.

    IF(ISTEXT(B10)*NOT(ISNUMBER(B10*1)),»Text»,»Not text»)

    becomes

    IF(0,»Text»,»Not text»)

    and returns «Not text» in cell C10.

    Get Excel *.xlsx file

    If cell contains any text.xlsx

    test

    If cell contains text from list
    This article demonstrates several ways to check if a cell contains any value based on a list. The first example […]

    test

    If cell contains multiple values
    This article demonstrates formulas that perform a partial match for a given cell using multiple strings specified in cells F2 […]

    test

    test

    test

    How to simplify nested IF functions
    Nested IF statements in a formula are multiple combined IF functions so more conditions and outcomes become possible. They all are […]

    test

    If cell equals value from list
    This article demonstrates formulas that check if a cell value is equal to any value in a given list. Table […]

    test

    If cell contains text
    This article demonstrates different formulas based on if a cell contains a given text. Formula in cell C3: =B3=$E$3 The […]

    test

    If cell has value
    The easiest way to check if a cell has a value is, in my opinion, to use the equal sign […]

    Latest updated articles.

    More than 300 Excel functions with detailed information including syntax, arguments, return values, and examples for most of the functions used in Excel formulas.

    More than 1300 formulas organized in subcategories.

    Excel Tables simplifies your work with data, adding or removing data, filtering, totals, sorting, enhance readability using cell formatting, cell references, formulas, and more.

    Allows you to filter data based on selected value , a given text, or other criteria. It also lets you filter existing data or move filtered values to a new location.

    Lets you control what a user can type into a cell. It allows you to specifiy conditions and show a custom message if entered data is not valid.

    Lets the user work more efficiently by showing a list that the user can select a value from. This lets you control what is shown in the list and is faster than typing into a cell.

    Lets you name one or more cells, this makes it easier to find cells using the Name box, read and understand formulas containing names instead of cell references.

    The Excel Solver is a free add-in that uses objective cells, constraints based on formulas on a worksheet to perform what-if analysis and other decision problems like permutations and combinations.

    An Excel feature that lets you visualize data in a graph.

    Format cells or cell values based a condition or criteria, there a multiple built-in Conditional Formatting tools you can use or use a custom-made conditional formatting formula.

    Lets you quickly summarize vast amounts of data in a very user-friendly way. This powerful Excel feature lets you then analyze, organize and categorize important data efficiently.

    VBA stands for Visual Basic for Applications and is a computer programming language developed by Microsoft, it allows you to automate time-consuming tasks and create custom functions.

    A program or subroutine built in VBA that anyone can create. Use the macro-recorder to quickly create your own VBA macros.

    UDF stands for User Defined Functions and is custom built functions anyone can create.

    A list of all published articles.

    Понравилась статья? Поделить с друзьями:
  • If and sum functions in excel
  • If function excel any number
  • If and subtotal excel
  • If function contains word
  • If and substitute excel