Vous êtes sur la page 1sur 8

How to combine cells into a cell with space, commas

and semicolon in Excel?


When you combine the cells of a range into a single cell, the combined data may be
separated by nothing. But if you want to separate them with specified marks, such as
space, commas, semicolon or others, how can you do? This tutorial will introduce
some cuts for you.
In Excel, you can use a formula to combine a row of cells or a column of cells into a
single cell. Please do as follows:
Combine cells based on row or column into one with space
Step 1. Typing the formula = A1&" "&B1&" "&C1 into a blank cell, and
press Enter button on the keyboard. See screenshot:

Step 2. Dragging the fill handle over the range that you want to apply this formula,
all of the cells have been combined into a cell based on row values with spaces.
See screenshot:

Tip: If you want to merge the cell values based on column, you just need to enter
this formula = A1&" "&A2&" "&A3&" "&A4 in adjacent blank cell that you want to
get the result. Then do as the above steps, you will get the following results:
Combine cells based on row or column into one with commas
Step 1. Typing the formula =A1&","&B1&","&C1 into a blank cell, and
press Enter button on the keyboard. See screenshot:

Step 2. Dragging the fill handle over the range that you want to apply this formula,
all of the cells in a row will be combined into a cell with commas. See screenshot:

Tip: You can also merge the column of cell values into one cell with commas, just
type this formula =A1&","&A2&","&A3&&A4.Then do with above steps.
Note: you can change "'," to meet your needs. For example, if you want to separate
the data with semicolons, you can change "," to ";".
Merge row / column of cells into one cell with specified marks by
Function
In Excel, you can also use function to combine cells of row or column into a single
cell with spaces or specified marks.
1. Hold ALT button and press F11 on the keyboard to open a Microsoft Visual Basic
for Application window.
2. Click Insert > Module, and copy the VBA into the module.
VBA: Combine cells based on row or column into one with commas:
1
2 Function Combine(WorkRng As Range, Optional Sign As String = ",") As String
'Update 20130815
3 Dim Rng As Range
4 Dim OutStr As String
5 For Each Rng In WorkRng
6 If Rng.Text <> "," Then
7 OutStr = OutStr & Rng.Text & Sign
End If
8 Next
9 Combine = Left(OutStr, Len(OutStr) - 1)
10 End Function
11
3. Typing formula =Combine(A1:C1) in a blank cell, and press Enter button in the
keyboard, and the data in cell A1 to C1 will be merged into a cell and separated by
commas. See screenshot:

4. Dragging the fill handle over the range that you want to apply this formula, all of
the cells in the row will be combined into a cell with commas. See screenshot:
Tip: With above User Defined Function, you can also combine cell values based on
column, you just need to enter this formula =Combine(A1:A4) after copying above
code into the Module.
Note: You can change "," to meet your need. For example, if you want to merge cells
into a cell with space, you can change "," to" ".
Split text into
different columns
with the Convert Text
to Columns Wizard
Applies To: Excel 2016 , Excel 2013 , Excel 2010 , Excel 2007

You can take the text in one or more cells, and spread it out
across multiple cells. This is called parsing, and is the opposite
of concatenating, where you can combine text from two or
more cells into one cell. For example, if you have a column of
full names, you can split that column into separate first name
and last name columns, like this:
Go to Data > Text to Columns, and the wizard will walk you
through the process. Heres a full breakdown of how it works:
1. Select the cell or column that contains the text you want to split.

NOTE: Select as many rows as you want, but no more than one column. Make sure theres enough empty columns
to the right so nothing over there gets overwritten. If you dont have enough empty columns, add them.

2. Click Data >Text to Columns.

3. This starts the Convert Text to Columns Wizard. Click Delimited > Next.

4. Check Space, and clear the rest of the boxes, or check Comma and Space if that is how your
text is split (Smith, John, with a comma and space between the names). You can see a preview of
your data in the Data preview window.
5. Click Next.

6. In this step, you pick the format for your new columns, or you can let Excel do it for you. If you
want to pick your own format, select the format you want, such as Text, click the second column of
data in the Data preview window, and click the same format again. Repeat for all the columns in
the previewwindow.

7. Click the button to the right of the Destination box to collapse the dialog box.
8. Select the cells in your workbook where you want to paste your split data. For example, if you
are dividing a full name into a first name column and a last name column, select the appropriate
number of cells in two adjacent columns.

9. Click the button to expand the dialog box, and then click Finish.

Vous aimerez peut-être aussi