Formula to get data with specific logic from a string

PANIGGR

New Member
Joined
Sep 4, 2015
Messages
15
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

JAMES WALKER(614726/8CZNISNS)

<colgroup><col width="97"></colgroup><tbody>
</tbody>
8CZNISNS
614726
ABC Ltd (306521476/3BAX80ZJ)

<colgroup><col width="97"></colgroup><tbody>
</tbody>
3BAX80ZJ
306521476
Woodside/Ltd (3953084/MZ0QR1LJ)

<colgroup><col width="97"></colgroup><tbody>
</tbody>
MZ0QR1LJ
3953084
Smiths) Ltd (467578/A3RJ67K3K)

<colgroup><col width="97"></colgroup><tbody>
</tbody>
A3RJ67K3K
467578
(Highland/YUYU(5961944/2GN4E1U8)

<colgroup><col width="97"></colgroup><tbody>
</tbody>
2GN4E1U8
5961944

<tbody>
</tbody>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
with Power Query aka Get&Transform

Column1Column1.1Column1.2
JAMES WALKER(614726/8CZNISNS)6147268CZNISNS
ABC Ltd (306521476/3BAX80ZJ)3065214763BAX80ZJ
Woodside/Ltd (3953084/MZ0QR1LJ)3953084MZ0QR1LJ
Smiths) Ltd (467578/A3RJ67K3K)467578A3RJ67K3K
(Highland/YUYU(5961944/2GN4E1U8)59619442GN4E1U8

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
1JAMES WALKER(614726/8CZNISNS)8CZNISNS614726
2ABC Ltd (306521476/3BAX80ZJ)3BAX80ZJ306521476
3Woodside/Ltd (3953084/MZ0QR1LJ)MZ0QR1LJ3953084
4Smiths) Ltd (467578/A3RJ67K3K)A3RJ67K3K467578
5(Highland/YUYU(5961944/2GN4E1U8)2GN4E1U85961944
6(Highland/abc(ok)(123456/A23B34XX)A23B34XX123456

<tbody>
</tbody>
Sheet4


Worksheet Formulas
CellFormula
B1=TRIM(SUBSTITUTE(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",LEN(A1))),LEN(A1)),")",""))
C1=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,LEN(A1)-LEN(B1)-2),"(",REPT(" ",LEN(A1))),LEN(A1)))

<tbody>
</tbody>

<tbody>
</tbody>
 
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,214,387
Messages
6,119,222
Members
448,877
Latest member
gb24

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