在Excel中拆分大写字母 [英] Split Uppercase words in Excel

查看:836
本文介绍了在Excel中拆分大写字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



原始值:



我想用大写分割单元格中的所有单词, pre> MikeJones
RinaJonesJunior
MichealSamuelsLurth

预期输出:

  Mike Jones 
Rina Jones Junior
Micheal Samuels Lurth

可以不使用VBA吗?

解决方案

承认了Excellll的卓越公式,最有效的代码解决方案将是 RegExp 。这避免了长时间的循环。



 函数SplitCaps(strIn As String)As String 
Dim objRegex As Object
Set objRegex = CreateObject vbscript.regexp)
与objRegex
.Global = True
.Pattern =([az])([AZ])
SplitCaps = .Replace(strIn, $ 1 $ 2)
结束
结束功能


I would like to split all words in my cell by Uppercase, an example:

Original values:

MikeJones
RinaJonesJunior
MichealSamuelsLurth

Expected output:

Mike Jones
Rina Jones Junior
Micheal Samuels Lurth

Can this be done without using VBA?

解决方案

Having acknowledged Excellll's remarkable formula, the most efficient code solution would be RegExp based. This avoids long loops.

Function SplitCaps(strIn As String) As String
Dim objRegex As Object
Set objRegex = CreateObject("vbscript.regexp")
With objRegex
    .Global = True
    .Pattern = "([a-z])([A-Z])"
    SplitCaps = .Replace(strIn, "$1 $2")
End With
End Function

这篇关于在Excel中拆分大写字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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