Notice that SEARCH returns a numeric position for the first three letters, and returns a #VALUE! error for "z", which is not found. For example, the formulas below show the result of looking for the letters "a", "p", "e", and "z" in the text "apple": =SEARCH("a","apple") // returns 1 If the text is not found, SEARCH returns a #VALUE error. If SEARCH finds the text, it returns the position of the text as a number. The SEARCH function is designed to look for specific text inside a larger text string. One solution is to create a logical test with the SEARCH and ISNUMBER functions, and then use an IF statement to return a final result. This means we can't use IF by itself to test for a substring like "abc" that might appear anywhere in a cell. However, one limitation of IF is that it does not support wildcards like "?" and "*". If you are familiar with Excel, you will probably think first of the IF function. For example, in the worksheet above, a formula returns "x" when a cell contains "abc". The goal is to do something if a cell contains a given substring.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |