Ever found yourself in a situation where you need to format a cell's content based on whether it contains specific text from another cell? Microsoft Excel's Conditional Formatting feature makes this possible with its "Contains Text" rule. Let's delve into how you can leverage this powerful tool to add conditional formatting that checks if a cell contains text from another cell.

Before we dive into the steps, let's understand why you might need this. Suppose you have a large dataset where you want to highlight cells that contain certain keywords from a separate list. Or perhaps you want to format cells based on whether they match any text in a specific cell. This guide will walk you through the process, ensuring you master this useful Excel skill.

Setting Up Your Workbook
To begin, ensure your workbook is set up with the necessary data. For this example, let's assume you have two columns: 'A' containing keywords and 'B' containing text you want to check against these keywords.

Here's a simple layout:
| Column A | Column B |
|---|---|
| Keyword1 | This is some text containing Keyword1 |
| Keyword2 | This text does not contain Keyword2 |
| Keyword3 | This text contains Keyword3 and other words |

Using the "Contains Text" Rule
Now, let's apply conditional formatting to Column B, checking if it contains text from Column A.
1. Select cells in Column B (B2:B4 in our case).

2. Click on 'Home' > 'Conditional Formatting' > 'New Rule'.
3. In the 'New Formatting Rule' dialog box, select 'Use a formula to determine which cells to format'.
4. In the 'Format values where this formula is true:' box, enter the following formula: `=COUNTIF($A$2:$A$4, "*"&B2&"*")>0`

5. Choose the formatting you want to apply (e.g., fill color) and click 'OK'.
Understanding the Formula




















The formula used here is `=COUNTIF($A$2:$A$4, "*"&B2&"*")>0`. Let's break it down:
- `$A$2:$A$4` refers to the range containing your keywords.
- `*&B2&*` wraps the content of the active cell (B2) with asterisks, making the COUNTIF function consider partial matches.
- `>0` checks if the count is greater than zero, i.e., if the cell contains any of the keywords.
This formula ensures that Excel formats cells in Column B that contain text from Column A.
Applying Conditional Formatting to Multiple Cells
If you want to apply this formatting to a larger range or multiple cells simultaneously, you can adjust the formula accordingly.
For example, if you want to apply the same formatting to cells in Column C that contain text from Column A, you can use the formula `=COUNTIF($A$2:$A$4, "*"&C2&"*")>0`.
Formatting Based on Multiple Conditions
You can also combine this rule with others to create more complex conditional formatting. For instance, you might want to format cells based on whether they contain specific text and also meet other criteria, such as being greater than a certain value.
To do this, you can use the AND function in your formula. For example, to format cells that contain text from Column A and are greater than 100, use the formula `=AND(COUNTIF($A$2:$A$4, "*"&B2&"*")>0, B2>100)`.
Mastering conditional formatting in Excel opens up a world of possibilities for data analysis and presentation. By understanding how to apply the "Contains Text" rule, you can create dynamic and engaging spreadsheets that help you make sense of your data.
Remember, practice makes perfect. Don't hesitate to experiment with different formulas and rules to find what works best for your specific needs. Happy formatting!