Split Alphabet only from Left Just before Numbers only in Power query

srehman

Board Regular
Joined
Jan 4, 2020
Messages
210
Office Version
  1. 2016
Platform
  1. Windows
Hi Team,

I have used following approach but not working

Text.Select([Rawdata],{"A".."Z"}) Data(AD1022010A) Result(ADA) wrong I need (AD)
Text.Select([Rawdata],{"0".."9"})





Split text & number power query.xlsx
DE
1Required Result
2RawdataStarting Alphabet from left before numbers
3AD102201AAD
4AIRLAIRL
5AP0332010BAP
6ARILS78ARILS
Sheet1
 

Attachments

  • text split from left.PNG
    text split from left.PNG
    4.6 KB · Views: 6

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
RawdataTBD
AD102201AAD
AIRLAIRL
AP0332010BAP
ARILS78ARILS

Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TS = Table.AddColumn(Source, "Number", each Text.Select([Rawdata],{"0".."9"})),
    TBD = Table.AddColumn(TS, "TBD", each try Text.BeforeDelimiter([Rawdata], [Number]) otherwise [Rawdata], type text),
    RC = Table.RemoveColumns(TBD,{"Number"})
in
    RC
 
Upvote 0
One Problem here

Split text & number power query.xlsx
FG
11RawdataTBD
12AD102201AAD
13AIRLAIRL
14AP0332010BAP
15ARILS78ARILS
16DD3403A1DD3403A1
Sheet1
 
Upvote 0
RawdataText Range
AD102201AAD
AIRLAIRL
AP0332010BAP
ARILS78ARIL
DD3403A1DD

Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Number = Table.AddColumn(Source, "Number", each Text.Select([Rawdata],{"0".."9"})),
    LenRaw = Table.AddColumn(Number, "Length", each Text.Length([Rawdata]), Int64.Type),
    LenNum = Table.AddColumn(LenRaw, "Length.1", each Text.Length([Number]), Int64.Type),
    Subtract = Table.AddColumn(LenNum, "Subtraction", each [Length] - [Length.1], type number),
    IF = Table.AddColumn(Subtract, "IF", each if [Length.1] = 0 then [Length] else [Subtraction]-1),
    Range = Table.AddColumn(IF, "Text Range", each Text.Middle([Rawdata], 0, [IF]), type text),
    TSC = Table.SelectColumns(Range,{"Rawdata", "Text Range"})
in
    TSC
 
Upvote 0
this is now with more data sorry i could't add in my prev post
 
Upvote 0
Thanks Perfect Working Rich, & Sandy your solution is perfect as well according to my post.

You Guys are gr8.
Take Care
 
Upvote 0

Forum statistics

Threads
1,223,786
Messages
6,174,547
Members
452,571
Latest member
MarExcelTips

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