Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1774|回复: 3

[已解决]提取文本中最右边的数字

[复制链接]
发表于 2016-9-8 16:22 | 显示全部楼层 |阅读模式
如题
最佳答案
2016-9-8 16:47
1.jpg
  1. Function GETNUM(rng As Range) As Double
  2. Dim regx As Object
  3. Set regx = CreateObject("vbscript.regexp")
  4. With regx
  5.     .Global = True
  6.     .Pattern = "\d+\.*\d*"
  7.     Set matcs = .Execute(rng.Value)
  8.     GETNUM = matcs(matcs.Count - 1)
  9. End With
  10. End Function
复制代码
求助-自定义函数.rar (8.65 KB, 下载次数: 5)

求助.rar

2.19 KB, 下载次数: 3

发表于 2016-9-8 16:47 | 显示全部楼层    本楼为最佳答案   
1.jpg
  1. Function GETNUM(rng As Range) As Double
  2. Dim regx As Object
  3. Set regx = CreateObject("vbscript.regexp")
  4. With regx
  5.     .Global = True
  6.     .Pattern = "\d+\.*\d*"
  7.     Set matcs = .Execute(rng.Value)
  8.     GETNUM = matcs(matcs.Count - 1)
  9. End With
  10. End Function
复制代码
求助-自定义函数.rar (8.65 KB, 下载次数: 5)

评分

参与人数 1 +1 收起 理由
苏子龙 + 1 很给力

查看全部评分

回复

使用道具 举报

发表于 2016-9-8 16:50 | 显示全部楼层
我用函数解
=IF(A2="","",-LOOKUP(1,-RIGHT(A2,ROW($1:$20))))
回复

使用道具 举报

 楼主| 发表于 2016-9-8 16:54 | 显示全部楼层
谢谢!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-11 02:56 , Processed in 0.255341 second(s), 11 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表