Key Takeaways:
- The SEARCH function in Excel can locate the position of specific text within another text string, returning an error if the text is not found. It utilizes the syntax `=SEARCH(find_text, within_text, [start_num])`, where `find_text` is the text you’re searching for and `within_text` is where the search is conducted. The optional `start_num` parameter allows you to specify the starting character position for the search.
- To check if a cell contains specific words and return a value based on that search, a combination of IFERROR and SEARCH functions can be employed, as in the formula `=IFERROR(IF(SEARCH(B2,A2,1)>0,A2,0),””)`. This searches for text from cell B2 within cell A2, and if found, returns the content of A2; else it returns an empty string.
- Excel’s Find feature is a straightforward method for locating cells that contain specific words. It is accessed through `Home > Find & Select > Find` or with the shortcut `Ctrl + F`, where users can enter the desired text and receive a list of all cells containing the search term by clicking `Find All`. This functionality is particularly useful for quickly finding and highlighting relevant information in large data sets.
Download the Excel Workbook below to follow along and understand how to locate cell that contains specific text in Excel –
Table of Contents
Using Find Feature
By following the steps provided below, it is possible to effectively locate positive feedback by utilizing a find feature in Excel.
STEP 1: Select the range that contains all the feedback (i.e. Column B).
STEP 2: Go to Home > Find & Select > Find. Or, simply press Ctrl + F to open the Find dialog box.
STEP 3: In the Find dialog box, enter the specific text you want to search. Here, it is the word “good”.
STEP 4: Click on the Find All button to display a list of all the cells containing the specified text.
All the cells that contain specific word i.e. good are displayed.
SEARCH Function
The SEARCH function is a text function in Excel used to get the starting position of a specified text in a text string. If the text is found, it returns the position or else it returns an error.
The syntax of the SEARCH function is –
=SEARCH(find_text, within_text, [start_num])
where,
- find_text: This is the text you want to find.
- within_text: This is the text string in which you want to search.
- start_num (optional): This specifies the character position from where the search should start.
You can combine SEARCH with ISNUMBER to get a boolean result i.e. TRUE and FALSE.
=ISNUMBER(SEARCH(find_text, within_text, [start_num]))
There can be 2 scenarios –
- Specified word is present – SEARCH will return the position and ISNUMBER will evaluate it as a number and return TRUE.
- Specified word is not present – SEARCH will return an error and ISNUMBER will return FALSE.
In this example, there are various products, and their feedback is mentioned in a table. You can easily find out the ones that are positive feedback (i.e. feedback contains the word “good”) using the SEARCH Function by following the steps below –
STEP 1: Enter the ISNUMBER function
=ISNUMBER(
STEP 2: Enter the SEARCH function.
=ISNUMBER(SEARCH(
STEP 3: Enter the first argument of the search function i.e. find_text. Here, it is the word “good”.
=ISNUMBER(SEARCH(“good”,
STEP 4: Enter the second argument of the search function i.e. within_text. Here, it is the cell B2.
=ISNUMBER(SEARCH(“good”,B2))
STEP 5: Copy the formula down.
COUNTIF Function
COUNTIF function is used to count the number of cells that match a specific condition. It can be employed to identify cells that contain the word “good”. Follow the steps below to understand how it can be done –
STEP 1: Enter the COUNTIF formula.
=COUNTIF(
STEP 2: Enter the first argument i.e. the range of cells you want to search within. Here, it is the cell B2.
=COUNTIF(B2,
STEP 3: Enter the second argument i.e. criteria that you want to check against. Here, it is “*good*”.
=COUNTIF(B2,”*good*”)
The asterisks (*) act as wildcard characters, allowing for any text before and after the word “good”. This means that the formula will count cells that contain the word “good” anywhere within their contents, regardless of the surrounding text.
STEP 4: Enter the greater than operator followed by 0.
=COUNTIF(B2,”*good*”)>0
If the count is greater than zero, it means there is at least one occurrence of the word “good”. The function will return TRUE else FALSE.
STEP 5: Copy the formula down.
Practical Scenarios for Text-Based Queries in Excel
Extracting Information with Partial Text Matches
When you’re knee-deep in data, quickly extracting the info you need is crucial. Excel offers you the power to zoom in on the details with partial text matches. Say you have a long list of email addresses and you want to filter out everyone from a particular domain. Instead of eyeing each one, you can use functions like SEARCH
to pinpoint the exact matches—letting you work smarter, not harder.
Automating Actions Based on Specific Text Triggers
Excel isn’t just for storing data – it’s a dynamic tool to make your workday a breeze, especially with automation. You can set up spreadsheets to carry out automatic actions when specific text triggers are present. Whether it’s sending an inventory alert once a cell reads “low stock” or categorizing customer feedback based on certain keywords, functions like IF
or COUNTIF
turn routine checks into instant, hands-free operations.
Hands-On Guide to Utilize Text-Focused Functions
Step-by-Step Exercises to Enhance Your Skills
If you’re itching to flex your Excel muscles, step-by-step exercises are your gym. From beginner-friendly lookups to mastering array formulas, practicing maneuvers with text data polishes your skillset. Start with simple FIND
and SEARCH
tasks, progress to incorporating them in VLOOKUP
, and before you know it, you’re slicing through data like a hot knife through butter. Remember, practice doesn’t just make perfect; it makes permanent.
Applying Conditional Formatting Based on Text Content
If you want your data to pop out, conditional formatting is like the paint to your canvas. Highlight cells containing important text, such as “urgent” or “deadline”, with eye-catching colors, or use icons and data bars for a visual cue. You simply select your range, dive into the ‘Conditional Formatting’ menu, and let Excel do the heavy lifting. Your crucial data will stand out, nudging you to prioritize as needed.
Tips for Optimizing Text Search Efficiency
The Role of Wildcards in Text Searches
Wildcards in Excel are the unsung heroes that amplify your search capabilities. With *, ?, and ~, you can tackle fuzzy searches like a pro. Whether you’re looking for all variations of a word or just want to match any one character, wildcards make it a cinch. Imagine needing to find “bookkeeper” or “book-keeper”; wildcards save you time by catching both, making sure you leave no cell unturned.
Avoiding Common Pitfalls with Case Sensitivity
Navigating case sensitivity in Excel can be a pickle, but with the right know-how, it’s a cinch. Remember, functions like SEARCH
are case-insensitive and might not always spot the difference between ‘apple’ and ‘Apple’. When detail matters, switch gears to FIND
or use EXACT
to match cases to a T. This attention to detail prevents any mix-ups, ensuring your data is not only precise but also meaningful.
FAQs
How do I apply a formula if a cell contains certain text?
To apply a formula if a cell contains certain text, use the IF
and SEARCH
combo. For instance, =IF(ISNUMBER(SEARCH("text",A1)),"Action if True","Action if False")
checks if ‘text’ is in A1 and specifies actions for either outcome. This little piece of logic can turn your spreadsheets into finely tuned instruments of efficiency.
Can I use text search to trigger formatting changes in Excel?
Absolutely! Excel’s conditional formatting is like a loyal sidekick that springs into action when text criteria are met. Select your cells, choose ‘Conditional Formatting’ from the Home tab, and create a new rule using ‘Format cells that contain’ with your text criteria. Watch as your cells transform in real-time, reflecting changes and highlights based on your set conditions.
How do you find particular text in Excel cell?
Finding specific text in an Excel cell is a snap. Press Ctrl+F to summon the Find and Replace dialog, type your desired text into ‘Find what:’, and hit ‘Find Next’ to hop to the first occurrence. To elevate your search, use wildcards like ‘*’ or ‘?’ for more flexibility in what you’re trying to locate.
While Excel lacks a dedicated formula for identifying a cell that contains specific text, three methods are explored: utilizing the Find feature, combining the SEARCH function with ISNUMBER, and employing the COUNTIF function. Any one of these methods can be used to accomplish the desired result.
John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.