简体   繁体   中英

Get first text and split using excel vba

I am trying to split the content by finding the first text from the column. Below are the text and result.

Input            Output
00Abc def        Abc def
0Abc hf001       Abc hf001
01738Hji hf      Hji hf
7HAJ he          HAJ he
HJSHJS gef       HJSHJS gef

I stole this answer, so all credit to this question.

https://superuser.com/questions/846822/find-first-letter-in-a-string

That questions gives you the position of the first ASCII character, which you can then use with MID , to create the following, assuming your data starts in A1 ,

=MID(A1, MIN(INDEX(ROW(INDIRECT("1:"&LEN(A1)))+((CODE(MID(UPPER(A1),ROW(INDIRECT("1:"&LEN(A1))),1))<65)+(CODE(MID(UPPER(A1),ROW(INDIRECT("1:"&LEN(A1))),1))>90))*1E+99,,)), LEN(A1))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM