How to Combine Data in Excel
In this article
Yes, you can combine data in Excel using the CONCATENATE function, the & operator, or Flash Fill. These methods merge text, numbers, or cell contents into a single cell without changing the source data. This is essential for creating readable strings, generating IDs, or formatting output for reports.
What You'll Need
- A computer with Microsoft Excel installed (Windows or macOS).
- Two or more data sets or columns you wish to merge. These can be text, numbers, or dates.
- Basic familiarity with selecting cells and typing formulas.
Step-by-Step
- Open your workbook and navigate to the sheet containing the data you want to combine. Ensure your data is organized in columns (for example, First Name in column A and Last Name in column B).
- Decide on the method. The & operator is the fastest for simple merges, while CONCATENATE is useful for more complex logic or when you need to reference a cell address. Flash Fill is ideal for recognizing patterns without typing a formula.
- Using the Ampersand (&) Operator:
- Click the cell where you want the combined result to appear.
- Type the equals sign (=) followed by the first cell reference (e.g., =A2).
- Type the ampersand (&) symbol.
- Type the second cell reference (e.g., &B2).
- Press Enter. Excel will concatenate the contents of A2 and B2 with no space between them. To add a space, type a space character within quotes, such as =A2 & " " & B2.
- Using the CONCATENATE Function:
- Select the cell where you want the result.
- Type =CONCATENATE(.
- Click the first cell you want to combine. The cell reference will appear in the formula bar.
- Type a comma (,) to separate arguments.
- Click the second cell.
- Close the parenthesis with ) and press Enter.
- Combining More Than Two Cells:
- Continue adding comma-separated cell references inside the function or chaining ampersands. For example, =CONCATENATE(A2, " ", B2, " ", C2) or =A2 & " " & B2 & " " & C2.
- Drag the fill handle (the small square in the bottom-right corner of the cell) down to apply the formula to the rest of your data set.
- Using Flash Fill:
- In an empty column next to your data, type the desired combined result for the first row manually. For example, if column A has "John" and column B has "Doe", type "John Doe" in the first row of the new column.
- Press Ctrl + E (Windows) or Cmd + E (Mac). Excel will automatically detect the pattern and fill the rest of the column with the combined names.
- Flash Fill is particularly useful for non-standard patterns, such as splitting a full name into a Title, First Name, and Last Name.
Common Mistakes
- Forgetting Text in Quotes: When including a separator like a space or a hyphen, you must wrap it in double quotation marks. Without quotes, Excel treats it as a mathematical operator or a missing argument, resulting in a #NAME? error or incorrect output.
- Incorrect Cell References: Be careful when selecting cells. If you select a range (e.g., A2:A10) instead of individual cells (A2, B2), the function will return an error because it expects a single value per argument.
- Using CONCATENATE for Too Many Items: The CONCATENATE function has a limit of 255 arguments. If you need to combine more than 255 cells, use the CONCAT function instead, which has a much higher limit.
- Ignoring Data Types: Combining text with numbers directly can sometimes result in text output being treated as a number in calculations. Ensure your formatting is consistent with how you intend to use the data.
Tips
- Use the CONCAT Function for Modern Spreadsheets: CONCAT was introduced in Excel 2016 and is more efficient than CONCATENATE. It handles longer strings of text better and is the preferred function in newer versions of the software.
- Custom Formatting for Dates: If you are combining date cells, the raw value might look like a number (e.g., 44562). To display it as a date, use the TEXT function inside your combination formula, such as =TEXT(A2, "mm/dd/yyyy") & B2.
- Handle Empty Cells: If there is a chance a cell is empty, use the IF function to provide a default value. For example, =A2 & " " & IF(B2="", "", B2) ensures that if the last name is missing, you don't end up with a trailing space.
- Keyboard Shortcuts: To quickly access the function wizard for CONCATENATE, type =CONCATENATE( and press Ctrl + A. This opens the arguments dialog to help you select the correct cells.
Troubleshooting
If your combination does not work as expected, check the following common issues.
Issue: The result shows a #NAME? error.
This usually happens when you misspell the function name or forget to close a parenthesis. Double-check that you typed =CONCATENATE( correctly and ensure all opening parentheses have a corresponding closing one. If you are using the & operator, ensure you are not missing an equals sign at the start of the formula.
Issue: The combined text is missing a separator.
If you see "JohnDoe" instead of "John Doe", you likely forgot to add the space character in quotes. Verify that your formula includes the text string " " (space, quote, space, quote) between the cell references.
Issue: Flash Fill did not work.
Flash Fill relies on recognizing a pattern. If the pattern is ambiguous or if there are hidden characters in the data, it may fail. Try manually typing the result for the second row instead of the first, or clear the cache by closing and reopening the workbook. If the data contains extra spaces, use the TRIM function to clean it before attempting Flash Fill.
Issue: The combined data is not updating.
If you edit the source data but the combined cell does not change, ensure you did not accidentally convert the combined cell to a static text value. You can convert it back by clicking the cell, pressing F2 to edit, and then pressing Enter. Alternatively, check that the cell is not formatted as "Text" in the Number Format section of the Home tab, which can lock in values.
Frequently Asked Questions
How do I combine text and numbers in Excel?
When combining text and numbers, Excel automatically converts the number to text. However, if you want to ensure the number retains its formatting (like currency or date), use the TEXT function. For example, ="Total: " & TEXT(A2, "$0.00") will combine the word "Total:" with the formatted number in cell A2.
What is the difference between CONCAT and CONCATENATE?
CONCATENATE is the original function that has been in Excel for a long time. CONCAT is a newer, more efficient function that was introduced in Excel 2016. Both perform the same basic task, but CONCAT has a much higher limit on the number of arguments it can handle, making it more reliable for long strings.
Can I combine data from different sheets?
Yes. You can reference cells from other sheets by including the sheet name followed by an exclamation point in the cell reference. For example, =Sheet2!A2 & Sheet3!B2 will combine data from cell A2 on Sheet 2 and cell B2 on Sheet 3.
How do I combine text without a space?
Simply omit the space character from your formula. For example, =A2 & B2 will join the contents of A2 and B2 directly. If you only want to add a space between specific parts of a string, use the TRIM function to clean up any accidental double spaces, such as =TRIM(A2 & " " & B2).
Why does my combined date look like a number?
When you combine a date cell with text, Excel uses the underlying serial number of the date (e.g., 44562 for January 1, 2022) rather than the visual date. To fix this, wrap the date cell in the TEXT function to tell Excel how to format it, like =TEXT(A2, "yyyy-mm-dd") & B2.