Environment
- OS: Windows 10 Pro (Version: 20H2)
- Software: Microsoft Excel
Background
While working in Excel, I wanted to display a cell’s value embedded within a text string. For example, I wanted to display text combined with cell data, such as “Contact: XXX-XXXX.” I learned how to do this effectively.
Solution: Connect Strings and Cells Using the & Operator
In Excel, you use the & operator to combine text strings and cell values.
Basic Syntax
="Text String" & Cell Reference
Code Example (Displaying the value of cell C7 as a contact)
="Contact: " & C7
Code Explanation
- Start the formula with
=(equal sign). - Write the text string enclosed in double quotation marks (“”), like
"Contact: ". - Use
&(ampersand) to combine the text string and the value of cell C7.
If cell C7 contains a phone number like “090-xxxx-xxxx,” this will display: Contact: 090-xxxx-xxxx
Further Application (Combining Multiple Cells)
You can also link multiple items together, such as “String + Cell + String + Cell.”
Code Example for Multiple Connections
="Name: " & A2 & " Contact: " & C7
By doing this, you can create a layout in a single cell like: Name: John Doe Contact: 090-xxxx-xxxx
Summary
If you want to embed a cell value in the middle of a text string in Excel, the basic method is to link them using the & operator like this:
="Text String" & Cell Reference
This is very convenient for creating documents or formatting data because you can easily incorporate cell contents into part of a message.
