Select numbers from a string to the first alphabetical character

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
767
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

I have an issue that I cant currently find an answer online for.

I have a number of reports that I am analysing where the column data can have a value a numeric and alphabetical reference.

Is there a way to create a formula in PowerPivot where the column will work out the numeric characters up to the first alphabetical

Example 123456AB123 - 123456 or 123A1564 - 123

Is there away to do this in PowerPivot or would I be best doing this in a formula in Excel prior to uploading into Excel (if so what do I use)

thanks in advance
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
The best solution would be to load the data to Power Query. Transform the data in there then Load to the Data Model.

Peter
 
Upvote 0
Not sure about PowerPivot but in case no one comes back to you with the relevant answer, here's an Excel formula that you can use:

Rich (BB code):
=LEFT(A1,SUMPRODUCT(SMALL(IF(CODE(MID(A1,ROW($A$1:INDEX($A:$A,LEN(A1))),1))>=65,ROW($A$1:INDEX($A:$A,LEN(A1))),""),1))-1)

You need to enter it using Ctrl+Shift+Enter. The result:

1579710924415.png
 
Upvote 0
thank you, this has worked in Excel, so I will just re upload the data into PowerPivot
 
Upvote 0
:) you're most welcome.

I actually just tried to do the same in PowerQuery and the task seems to be even easier:

Home > Split Column > By Digit to Non-Digit

The result:
1579774340417.png
 
Upvote 0
Another Excel formula approach:
1579776909483.png

Formula: =LOOKUP(--REPT(9,LEN(A1)),--LEFT(A1,ROW(INDEX(A:A,1,1):INDEX(A:A,LEN(A1),1))))
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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