Separate data in a cell to different cells

klllmmm

New Member
Joined
Nov 14, 2015
Messages
13
I have a data set in below type in a column. How can I extract & put them into separate columns.

[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 242"]
<tbody>[TR]
[TD]Code:1+Name:Book+Size:200pg+Price:100+Vendor:Abooks[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
<strike></strike>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 242"]
<tbody>[TR]
[TD]Code:2+Name:Pen+Size:Standard+Price:10+Vendor:Abooks[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
<strike></strike>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 242"]
<tbody>[TR]
[TD]Code:3+Name:Bag+Size:Standard+Price:250+Vendor:TopBags[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
<strike></strike>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I worked to some extent using below formula.
MID(A1,1,FIND("+",A1)-1) = Code:1 , MID(Q7,FIND("+",A1,1)+1,FIND("+",A1,2)) = Name:Bo

I want to get the data into separate cells as follows;

[TABLE="width: 500"]
<tbody>[TR]
[TD]Code:1<strike></strike>
[/TD]
[TD]Name:Book<strike></strike>
[/TD]
[TD]Size:200pg<strike></strike>
[/TD]
[TD]Price:100<strike></strike>
[/TD]
[TD]Vendor:Abooks<strike></strike>
[/TD]
[/TR]
[TR]
[TD]Code:2<strike></strike>
[/TD]
[TD]Name:Pen<strike></strike>
[/TD]
[TD]Size:Standard<strike></strike>
[/TD]
[TD]Price:10<strike></strike>
[/TD]
[TD]Vendor:Abooks<strike></strike>
[/TD]
[/TR]
[TR]
[TD]Code:3<strike></strike>
[/TD]
[TD]Name:Bag<strike></strike>
[/TD]
[TD]Size:Standard<strike></strike>
[/TD]
[TD]Price:250<strike></strike>
[/TD]
[TD]Vendor:TopBags<strike></strike>
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I Prefer to use a formula rather than text to column. Data is not in the same order. It's a large chunk of data set. I want to prepare a data table from this data set. Something similar to this.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Code[/TD]
[TD]Name[/TD]
[TD] Size [/TD]
[TD]Price [/TD]
[TD]Vendor[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Book[/TD]
[TD]200pg[/TD]
[TD]100[/TD]
[TD]Abooks[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Pen[/TD]
[TD]Standard[/TD]
[TD]10[/TD]
[TD]Abooks[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Bag[/TD]
[TD]Standard[/TD]
[TD]250[/TD]
[TD]Topbags[/TD]
[/TR]
</tbody>[/TABLE]


Thank you very much for your time & effort.....
 
Upvote 0
You did say -

I want to get the data into separate cells as follows;

[TABLE="class: cms_table, width: 500"]
<tbody>[TR]
[TD]Code:1<strike></strike>[/TD]
[TD]Name:Book<strike></strike>[/TD]
[TD]Size:200pg<strike></strike>[/TD]
[TD]Price:100<strike></strike>[/TD]
[TD]Vendor:Abooks<strike></strike>[/TD]
[/TR]
[TR]
[TD]Code:2<strike></strike>[/TD]
[TD]Name:Pen<strike></strike>[/TD]
[TD]Size:Standard<strike></strike>[/TD]
[TD]Price:10<strike></strike>[/TD]
[TD]Vendor:Abooks<strike></strike>[/TD]
[/TR]
[TR]
[TD]Code:3<strike></strike>[/TD]
[TD]Name:Bag<strike></strike>[/TD]
[TD]Size:Standard<strike></strike>[/TD]
[TD]Price:250<strike></strike>[/TD]
[TD]Vendor:TopBags[/TD]
[/TR]
</tbody>[/TABLE]


What do you mean by "Data is not in the same order"?
 
Upvote 0
Try

=MID(A1,FIND(":",A1)+1,1)

=MID(A1,FIND("me:",A1)+3,FIND("+S",A1)-3-FIND("me:",A1))

=MID(A1,FIND("ze:",A1)+3,FIND("+P",A1)-3-FIND("ze:",A1))

=MID(A1,FIND("ce:",A1)+3,FIND("+V",A1)-3-FIND("ce:",A1))

=MID(A1,FIND("or:",A1)+3,99)

Code:
[/FONT]
[TABLE="width: 325"]
<!--StartFragment--> <colgroup><col width="65" span="5" style="width:65pt"> </colgroup><tbody>[TR]
  [TD="width: 65"]1[/TD]
  [TD="width: 65"]Book[/TD]
  [TD="width: 65"]200pg[/TD]
  [TD="width: 65"]100[/TD]
  [TD="width: 65"]Abooks[/TD]
 [/TR]
 [TR]
  [TD]2[/TD]
  [TD]Pen[/TD]
  [TD]Standard[/TD]
  [TD]10[/TD]
  [TD]Abooks[/TD]
 [/TR]
 [TR]
  [TD]3[/TD]
  [TD]Bag[/TD]
  [TD]Standard[/TD]
  [TD]250[/TD]
  [TD]TopBags[/TD]
 [/TR]
<!--EndFragment--></tbody>[/TABLE]
[FONT=Lucida Grande]
 
Upvote 0
Thank you vary much Mr. gaz_chops. Its a perfect solution.

I meant by data not in order means sometimes data appears like this too

Code:1+Name:Book+Size:200pg+Price:100+Vendor:Abooks
Code:2+Size:Standard+Name:Pen+Vendor:Abooks+Price:10
Its all-right. Thanks again
 
Upvote 0
Thank you vary much Mr. gaz_chops. Its a perfect solution.

I meant by data not in order means sometimes data appears like this too

Code:1+Name:Book+Size:200pg+Price:100+Vendor:Abooks
Code:2+Size:Standard+Name:Pen+Vendor:Abooks+Price:10
Its all-right. Thanks again

You're welcome, but note that my solution won't work if they are not in the order of your original post.
 
Upvote 0
For items in any order, try this formula copied across and down.

Excel Workbook
ABCDEF
1CodeNameSizePriceVendor
2Code:1+Name:Book+Size:200pg+Price:100+Vendor:Abooks1Book200pg100Abooks
3Code:2+Name:Pen+Size:Standard+Price:10+Vendor:Abooks2PenStandard10Abooks
4Code:3+Name:Bag+Size:Standard+Price:250+Vendor:TopBags3BagStandard250TopBags
5Code:2+Size:Standard+Name:Pen+Vendor:Abooks+Price:102PenStandard10Abooks
6Vendor:Abc+Size:Large+Code:201+Price:20.55+Name:Folder201FolderLarge20.55Abc
Extract Items
 
Upvote 0
Another option,

In B2 enter formula, copy across to F2 and all copy down :

=TRIM(LEFT(SUBSTITUTE(MID($A2,FIND(B$1,$A2&B$1)+LEN(B$1)+1,90),"+",REPT(" ",90)),90))

Regards
 
Upvote 0
.. or with one less function call

=REPLACE(LEFT($A2,FIND("+",$A2&"+",FIND(B$1,$A2))-1),1,FIND(B$1,$A2)+LEN(B$1),"")
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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