如何拆分/解析Excel中第一个数字的字符串 [英] How do I split/parse a string around the first number in Excel

查看:324
本文介绍了如何拆分/解析Excel中第一个数字的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在A列有一个字母和数字的混合字符串。我想在第一个数字之前将字符串拆分一半,使得abc123在列B中变为abc,在列C中为123。

解决方案

如果有任何类型的模式,例如总是3个字母.....或只有3或4个字母,例如,那么你可以更容易地实现,但是对于任何数量的字母(假设数字总是跟随字母),你可以在B2中使用这个公式(这比建议公式在topcat3的链接,我想)



= LEFT(A2,MIN(FIND({1,2,3,4,5, 6,7,8,9,0},A2& 1234567890)) - 1)



然后C2中的这个公式>

= REPLACE(A2,1,LEN(B2),)



请注意,最后一个公式会将数字部分作为文本值返回 - 如果您希望将其作为数字加+0到公式结尾(但您将失去任何前导零)


I have a string in column A that is a mixture of letters and numbers. I want to split the string in half before the first number that shows up such that "abc123" becomes "abc" in column B and "123" in column C.

解决方案

If there's any sort of pattern, e.g. always 3 letters.....or only 3 or 4 letters, for example then you can achieve more easily but for any number of letters (assuming that numbers always follow letters) you can use this formula in B2 (which is simpler than the suggested formula in topcat3's link, I think)

=LEFT(A2,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A2&1234567890))-1)

and then this formula in C2

=REPLACE(A2,1,LEN(B2),"")

Note that this last formula returns the number part as a text value - if you want it to be numeric add +0 to end of formula (but you will lose any leading zeroes)

这篇关于如何拆分/解析Excel中第一个数字的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆