Formula to get data with specific logic from a string

PANIGGR

New Member
Joined
Sep 4, 2015
Messages
18
I have below data in column A, in this string suffixed with data like "(12345/A76D7YF)". I need numeric and alphanumeric character in two different columns. Please note that customer names before above section may also contain (, ) and /. Uniqueness of column A is that after the last open bracket "(", the required numeric and alphanumeric data comes which may help is building any logic/VBA code

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]

<colgroup><col width="97"></colgroup><tbody>
[TD="class: xl66, width: 97"]JAMES WALKER (614726/ 8CZNISNS )
[/TD]

</tbody>
[/TD]
[TD]8CZNISNS
[/TD]
[TD]614726
[/TD]
[/TR]
[TR]
[TD]

<colgroup><col width="97"></colgroup><tbody>
[TD="class: xl66, width: 97"]ABC Ltd (306521476/ 3BAX80ZJ )
[/TD]

</tbody>
[/TD]
[TD]3BAX80ZJ
[/TD]
[TD]306521476
[/TD]
[/TR]
[TR]
[TD]

<colgroup><col width="97"></colgroup><tbody>
[TD="class: xl66, width: 97"]Woodside/Ltd (3953084/ MZ0QR1LJ )
[/TD]

</tbody>
[/TD]
[TD]MZ0QR1LJ
[/TD]
[TD]3953084
[/TD]
[/TR]
[TR]
[TD]

<colgroup><col width="97"></colgroup><tbody>
[TD="class: xl66, width: 97"]Smiths) Ltd (467578/ A3RJ67K3K )
[/TD]

</tbody>
[/TD]
[TD]A3RJ67K3K
[/TD]
[TD]467578
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 97"]
<colgroup><col width="97"></colgroup><tbody>[TR]
[TD="class: xl66, width: 97"](Highland/YUYU(5961944/2GN4E1U8)
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]2GN4E1U8
[/TD]
[TD]5961944
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
with Power Query aka Get&Transform

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Column1[/td][td][/td][td=bgcolor:#70AD47]Column1.1[/td][td=bgcolor:#70AD47]Column1.2[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]JAMES WALKER(614726/8CZNISNS)[/td][td][/td][td=bgcolor:#E2EFDA]614726[/td][td=bgcolor:#E2EFDA]8CZNISNS[/td][/tr]

[tr=bgcolor:#FFFFFF][td]ABC Ltd (306521476/3BAX80ZJ)[/td][td][/td][td]306521476[/td][td]3BAX80ZJ[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Woodside/Ltd (3953084/MZ0QR1LJ)[/td][td][/td][td=bgcolor:#E2EFDA]3953084[/td][td=bgcolor:#E2EFDA]MZ0QR1LJ[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Smiths) Ltd (467578/A3RJ67K3K)[/td][td][/td][td]467578[/td][td]A3RJ67K3K[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7](Highland/YUYU(5961944/2GN4E1U8)[/td][td][/td][td=bgcolor:#E2EFDA]5961944[/td][td=bgcolor:#E2EFDA]2GN4E1U8[/td][/tr]
[/table]


Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Extract = Table.TransformColumns(Source, {{"Column1", each Text.BetweenDelimiters(_, "(", ")", {0, RelativePosition.FromEnd}, 0), type text}}),
    Split = Table.SplitColumn(Extract, "Column1", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Column1.1", "Column1.2"})
in
    Split[/SIZE]
 
Upvote 0
Formula option:

Excel 2012
ABC
JAMES WALKER(614726/8CZNISNS)8CZNISNS
ABC Ltd (306521476/3BAX80ZJ)3BAX80ZJ
Woodside/Ltd (3953084/MZ0QR1LJ)MZ0QR1LJ
Smiths) Ltd (467578/A3RJ67K3K)A3RJ67K3K
(Highland/YUYU(5961944/2GN4E1U8)2GN4E1U8
(Highland/abc(ok)(123456/A23B34XX)A23B34XX

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]614726[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]306521476[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]3953084[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]467578[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]5961944[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]123456[/TD]

</tbody>
Sheet4


[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]B1[/TH]
[TD="align: left"]=TRIM(SUBSTITUTE(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",LEN(A1))),LEN(A1)),")",""))[/TD]
[/TR]
[TR]
[TH]C1[/TH]
[TD="align: left"]=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,LEN(A1)-LEN(B1)-2),"(",REPT(" ",LEN(A1))),LEN(A1)))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
copy M-code from the post
use Ctrl+T to change range to Excel Table
use From Table option
screenshot-108.png

open Advanced Editor and replace code there with copied code
screenshot-109.png


btw. this is NOT vba
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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