Excel Formula: Copy Cell If Adjacent Cell Contains Text

Intro

Using Excel formulas to copy cells based on conditions can greatly enhance your data management and analysis capabilities. Here's how you can copy a cell's content if its adjacent cell contains specific text, using Excel formulas.

Scenario

Suppose you have a list of names in Column A and corresponding status updates in Column B. You want to copy the names (from Column A) into Column C if the status in Column B is "Active".

Name (A) Status (B) Active Names (C)
John Active
Alice Inactive
Bob Active
Charlie Pending

Solution

You can achieve this by using the IF function in combination with the ISNUMBER and SEARCH functions, or more simply with the IF function alone if you're looking for an exact match.

1. Using IF and SEARCH Functions

If you're looking to check if the adjacent cell contains specific text (not necessarily an exact match), you can use the combination of the IF, ISNUMBER, and SEARCH functions.

=IF(ISNUMBER(SEARCH("Active", B2)), A2, "")
  • Place this formula in cell C2.
  • "Active" is the text you're searching for in cell B2.
  • If "Active" is found, the formula returns the value in A2 (the name); otherwise, it returns a blank string.

2. Using IF Function Alone for Exact Match

If you're looking for an exact match, you can simplify the formula to use the IF function alone.

=IF(B2="Active", A2, "")
  • Place this formula in cell C2.
  • This checks if the content of B2 is exactly "Active". If true, it copies the content of A2; otherwise, it leaves the cell blank.

Implementation

  1. Select the cell where you want to display the names of active individuals (e.g., C2).
  2. Type the formula you've chosen based on your needs.
  3. Press Enter to apply the formula.
  4. Drag the fill handle (the small square at the bottom-right corner of the cell) down to apply the formula to all relevant cells in Column C.

This method is particularly useful for data filtering and manipulation, where you need to isolate specific data based on conditions in adjacent cells.

Tips for Advanced Use

  • To make the formula case-insensitive when using the SEARCH function, you can convert both the text to search and the search term to lower or upper case using the LOWER function.
  • For exact matches with case sensitivity using the IF function, ensure the case of the text matches exactly.
  • You can modify the formula to search for different conditions or apply more complex logic by combining it with other Excel functions, such as AND, OR, or NOT.

By mastering such Excel formulas, you can significantly streamline your workflow and improve your data analysis capabilities.

Jonny Richards

Love Minecraft, my world is there. At VALPO, you can save as a template and then reuse that template wherever you want.