How to Merge Two Lines in Excel: Step-by-Step Guide
In this article
To merge two lines in Excel, you combine the text from two cells into one using a formula, the ampersand operator, or the CONCAT function. The quickest way is to type =A1&" "&A2 in a new cell, which joins the contents of A1 and A2 with a space between them. If you want to keep the original lines intact, copy the result and paste it back as values. This guide walks through the exact steps, the formula options, and what to do when things do not line up.
What You'll Need
- Microsoft Excel (desktop or web version; steps apply to both, though menu labels may differ slightly by version and region).
- Your data already entered in two separate cells or rows.
- A blank cell or column to hold the merged result.
Step-by-Step
- Identify the two lines you want to merge. For example, if line 1 is in cell A1 and line 2 is in cell A2, note those addresses. If the lines are in two columns on the same row (like A1 and B1), the same logic applies.
- Click an empty cell where you want the merged text to appear, such as C1.
- Type the formula. For two cells stacked vertically, enter
=A1&" "&A2. For two cells side by side, enter=A1&" "&B1. The&symbol joins text, and the" "adds a space between the two parts. If you want a line break instead of a space, use=A1&CHAR(10)&A2and then turn on Wrap Text (Home tab > Wrap Text) so the break is visible. - Press Enter. The cell now shows the combined text. Check that the spacing looks right; if you need a comma or hyphen, replace the space inside the quotes with that character.
- Copy the formula down if you have more rows. Drag the fill handle (the small square at the bottom-right of the cell) down the column. Excel adjusts the cell references automatically.
- Convert the formula to plain text (optional but recommended). Select the merged cells, press Ctrl+C (Cmd+C on Mac), then right-click and choose Paste Special > Values. This removes the formula so the result no longer depends on the original cells. Warning: if you delete the original columns after this step, the pasted values remain, but if you skip this step and delete the source cells, the merged text will show errors.
- Delete or hide the original columns once you are satisfied. Keep a backup copy of the sheet first in case you need to reverse the change.
Common Mistakes
- Forgetting the space or separator. Writing
=A1&A2produces "JohnSmith" instead of "John Smith". Always include a separator inside quotes if you want one. - Using Merge & Center instead of a formula. The Merge & Center button on the Home tab combines cells into one large cell, but it does not combine the text inside them. It keeps only the upper-left value and discards the rest. Use a formula for joining text.
- Leaving formulas in place and then deleting source cells. This causes #REF! errors. Paste as values first.
- Mixing text and numbers without formatting. A date in A1 may appear as a serial number when joined. Use TEXT() to control the format, for example
=TEXT(A1,"mm/dd/yyyy")&" "&A2. - Assuming CHAR(10) shows a line break immediately. It only works when Wrap Text is enabled on that cell.
Tips
- Use
=CONCAT(A1," ",A2)or=TEXTJOIN(" ",TRUE,A1:A2)for a cleaner look, especially with many cells. TEXTJOIN lets you ignore empty cells. - To merge an entire column of names into one cell, use
=TEXTJOIN(", ",TRUE,A1:A10). - If you need the result in a different order, just swap the cell references.
- Keep a helper column with the formula until you have verified the output, then paste as values into your final column.
- For a quick one-off merge without formulas, type the combined text manually into a new cell and delete the originals.
Troubleshooting
If the merged cell shows a formula error like #VALUE!, check that both referenced cells contain text or numbers, not error values. If the result looks like a date serial number, apply TEXT() as shown above. If the line break does not appear, select the cell and click Wrap Text on the Home tab. If the formula returns the same value for every row, make sure you used relative references (A1, A2) rather than absolute ones ($A$1). If you accidentally used Merge & Center and lost data, press Ctrl+Z immediately to undo; once saved and closed, the lost values cannot be recovered from that file. If the merged text is cut off, widen the column or enable Wrap Text. If you see #REF! after deleting columns, the formula was still live; restore the columns or re-enter the values manually.
Frequently Asked Questions
Can I merge two lines without a formula?
Yes. Type the combined text directly into a new cell, or use Merge & Center only if you want one large cell and are willing to keep just the upper-left value. For joining text, a formula is safer.
How do I merge two lines with a line break in Excel?
Use =A1&CHAR(10)&A2 and then turn on Wrap Text for that cell. On Windows, Alt+Enter inside a cell also inserts a manual line break.
What is the difference between CONCAT and TEXTJOIN?
CONCAT joins a list of values but does not let you skip blanks easily. TEXTJOIN lets you set a delimiter and ignore empty cells, which is useful for ranges.
Why does my merged cell show a number instead of a date?
Excel stores dates as serial numbers. Wrap the date cell in TEXT() with your desired format before joining.
Can I undo a merge?
If you used a formula, simply delete the formula cell. If you used Merge & Center, press Ctrl+Z right away; after saving and closing, the discarded values are gone, so keep a backup.
Does this work in Excel for the web?
Yes, the ampersand, CONCAT, and TEXTJOIN formulas work in Excel for the web. Menu labels for Wrap Text and Paste Special may appear slightly differently but the functions are the same.