Extract Data From Single Cell [merged] to Multiple Column

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,105
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all.

how to extract data from single cell (merged cell) like this:
Book1
ABCDE
1dataextract
2Mr XXX 198505162008121003 New York, 16-05-1985Mr XXX198505162008121003New York16/05/1985
3
4
5
6
7Mrs. YYYY 197404231996021001 Hongkong, 23-04-1974Mrs. YYYY197404231996021001Hongkong23/04/1974
8
9
10
11
12Mr ZZZZZZZZZ 198301282009012003 France, 28-01-1983etc…...
13
14
Sheet1


thanks in advance,
 
Perhaps use Power Query after selecting your range and making it an XL table called "Table"
Excel Formula:
let
    Source = Excel.CurrentWorkbook(){[Name="Table"]}[Content],
    #"Filtered Rows" = Table.SelectRows(Source, each ([data] <> null)),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows", "data", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), {"data.1", "data.2", "data.3"}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter", "data.3", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"data.3.1", "data.3.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"data.3.2", type date}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"data.1", "Name"}, {"data.2", "Number"}, {"data.3.1", "Place"}, {"data.3.2", "Date"}})
in
    #"Renamed Columns"
 
Upvote 0
Try (for sure in excel 365, I'm not sure if it's good in 2021 too)) in B2:
Excel Formula:
=IF(A2<>"",TEXTSPLIT(A2,CHAR(10)),"")
and copy down

Or just a single formula in B2 as shown on this XL2BB snippet:
Book1
ABCDE
1dataextract
2Mr XXX 198505162008121003 New York, 16-05-1985Mr XXX198505162008121003New York, 16-05-1985
3
4
5
6
7Mrs. YYYY 197404231996021001 Hongkong, 23-04-1974Mr XXX198505162008121003New York, 16-05-1985
8
9
10
11
12Mr ZZZZZZZZZ 198301282009012003 France, 28-01-1983Mr XXX198505162008121003New York, 16-05-1985
13
Sheet2
Cell Formulas
RangeFormula
B2:D12B2=IF(A2:A12<>"",TEXTSPLIT(A2,CHAR(10)),"")
Dynamic array formulas.
 
Upvote 0
=IF(A2<>"",TEXTSPLIT(A2,CHAR(10)),"") does not split the place and date...
Try
Excel Formula:
=IF(A2<>"",TRIM(TEXTSPLIT(SUBSTITUTE(A2,CHAR(10),"%");{"%",","}),"")
You can replace % with any string you are sure will never appear
 
Last edited:
Upvote 0
FYI
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
Going back to formulas - Indeed, I was glad that I noticed it is CHAR(10) and I missed the second part.

So my corrected proposition is either a longer:
Excel Formula:
=IF(A2:A12<>"",TEXTSPLIT(A2,MAKEARRAY(1,2,LAMBDA(r,c,CHAR(34*c-24)))),"")
or shorter one:
Excel Formula:
=IF(A2:A12<>"",TEXTSPLIT(SUBSTITUTE(A2,CHAR(10),","),","),"")
 
Upvote 0
@Kaper
I wonder if you tested either of those post #7 suggestions with the sample data &/or looked closely at the results?
Also check the mini sheet results in post #4

@arthurbr
You do not have matching parentheses and also have a mix of comma and semicolon formula separators.
It would also be simpler to substitute the CHAR(10) with a comma (as @Kaper has tried) as you then only need one TEXTSPLIT delimiter instead of two.

So, my combination suggestion is this.

25 02 18.xlsm
ABCDE
1data
2Mr XXX 198505162008121003 New York, 16-05-1985Mr XXX198505162008121003New York16-05-1985
3 
4 
5 
6 
7Mrs. YYYY 197404231996021001 Hongkong, 23-04-1974Mrs. YYYY197404231996021001Hongkong23-04-1974
8 
9 
10 
11 
12Mr ZZZZZZZZZ 198301282009012003 France, 28-01-1983Mr ZZZZZZZZZ198301282009012003France28-01-1983
13
14
Split
Cell Formulas
RangeFormula
B2:E2,B12:E12,B7:E7,B3:B6,B8:B11B2=IF(A2<>"",TRIM(TEXTSPLIT(SUBSTITUTE(A2,CHAR(10),","),",")),"")
Dynamic array formulas.
 
Upvote 0
@Peter_SSs

Indeed, I shall clear my glases :)
Formulas in #7 shall be based on single cell (not a range) and then copied.

Sorry for that mess. I'm going to brew a coffe for myself. Or may be better, I'd buy one ready made ;)
 
Upvote 0
Sorry for that mess. I'm going to brew a coffe for myself. Or may be better, I'd buy one ready made ;)
Cheers, good plan. :)

BTW, the result can be obtained with dual delimiters without the SUBSTITUTE if the Alt+Enter is actually typed into the formula between double quote marks like this instead of using the CHAR() function.

25 02 18.xlsm
ABCDE
1data
2Mr XXX 198505162008121003 New York, 16-05-1985Mr XXX198505162008121003New York16-05-1985
3 
4 
5 
6 
7Mrs. YYYY 197404231996021001 Hongkong, 23-04-1974Mrs. YYYY197404231996021001Hongkong23-04-1974
8 
9 
10 
11 
12Mr ZZZZZZZZZ 198301282009012003 France, 28-01-1983Mr ZZZZZZZZZ198301282009012003France28-01-1983
13
14
Split (2)
Cell Formulas
RangeFormula
B2:E2,B12:E12,B7:E7,B3:B6,B8:B11B2=IF(A2<>"",TRIM(TEXTSPLIT(A2,{" ",","})),"")
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,226,771
Messages
6,192,918
Members
453,766
Latest member
Gskier

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top