Formula needed for removal of [] and data in.

chetan123

New Member
Joined
Dec 17, 2016
Messages
4
Can someone help me in providing formula for removing [] and data in it?


<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>[TABLE="width: 0"]
<colgroup><col style="width: 479px"><col width="349"></colgroup><tbody>[TR]
[TD="align: center"]DATA[/TD]
[TD="align: center"]RESULTS[/TD]
[/TR]
[TR]
[TD]ABC [2.5], JKB [23.3][/TD]
[TD]ABC, JKB[/TD]
[/TR]
[TR]
[TD]Norway [.45][/TD]
[TD]Norway[/TD]
[/TR]
[TR]
[TD]Smaller then1-5 days [12.5],5-12 days [34.5],13-25 days [23.3], 26-50 days [45.2][/TD]
[TD]Smaller then1-5 days, 5-12 days ,13-25 days , 26-50 days[/TD]
[/TR]
[TR]
[TD]DGF&co (fdg) [3.4][/TD]
[TD]DGF&co (fdg)[/TD]
[/TR]
[TR]
[TD]GEMINI PLC/THE [5.22], Leo CORP [23..0][/TD]
[TD]GEMINI PLC/THE, Leo CORP[/TD]
[/TR]
[TR]
[TD]empty[/TD]
[TD]empty[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Use the Find and Select Option on the Ribbon on the Home Tab. Select Find and Replace. When prompted Find All and Replace All.
 
Upvote 0
No formula but try flash fill. Just enter one or two rows of example data in a column to the left and press CTRL-E
 
Upvote 0
try PowerQuery but this is not full automated

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]DATA[/td][td][/td][td=bgcolor:#70AD47]Merged[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]ABC [2.5], JKB [23.3][/td][td][/td][td=bgcolor:#E2EFDA]ABC , JKB[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Norway [.45][/td][td][/td][td]Norway[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Smaller then1-5 days [12.5],5-12 days [34.5],13-25 days [23.3], 26-50 days [45.2][/td][td][/td][td=bgcolor:#E2EFDA]Smaller then1-5 days ,5-12 days ,13-25 days , 26-50 days[/td][/tr]

[tr=bgcolor:#FFFFFF][td]DGF&co (fdg) [3.4][/td][td][/td][td]DGF&co (fdg)[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]GEMINI PLC/THE [5.22], Leo CORP [23..0][/td][td][/td][td=bgcolor:#E2EFDA]GEMINI PLC/THE , Leo CORP[/td][/tr]
[/table]


Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Index = Table.AddIndexColumn(Source, "Index", 1, 1),
    Len = Table.AddColumn(Index, "Length", each Text.Length([DATA]), Int64.Type),
    Sort = Table.Sort(Len,{{"Length", Order.Descending}}),
    Split = Table.SplitColumn(Sort, "DATA", Splitter.SplitTextByAnyDelimiter({"[","]"}, QuoteStyle.Csv)),
    RC = Table.RemoveColumns(Split,{"DATA.2", "DATA.4", "DATA.6", "DATA.8", "DATA.9"}),
    Merge = Table.CombineColumns(RC,{"DATA.1", "DATA.3", "DATA.5", "DATA.7"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
    Trim = Table.TransformColumns(Merge,{{"Merged", Text.Trim, type text}}),
    Sort2 = Table.Sort(Trim,{{"Index", Order.Ascending}}),
    RC2 = Table.RemoveColumns(Sort2,{"Index", "Length"})
in
    RC2[/SIZE]
 
Last edited:
Upvote 0
Cross posted https://chandoo.org/forum/threads/formula-needed-for-removal-of-and-data-in.41663/

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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