从一串文本中提取数字 - Excel [英] extract number from a string of text - Excel

查看:296
本文介绍了从一串文本中提取数字 - Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从excel中的一串文本中拉出一个数字。
字符串是一个混合的alpha,数字和一些字符。



示例数据字符串: -

 网址
/products_list.php?retailer=8&cat=43
/products_list.php?retailer=22&cat=43
/ products_list.php?retailer = 8& cat = 1011
/products_list.php?retailer=81&cat=1023
/products_list.php?retailer=147&cat=1224
/ products_list。 php?retailer = 8& cat = 1
/products_list.php?retailer=147&cat=4
/products_list.php?retailer=147&cat=401

我想要实现的是





我从文本中拉出所有数字,但真的很可能不知道如何得到中间的数字或结尾的数字。



我尝试的解决问题的代码是: -

  = SUM(MID(0安培; A3,LARGE(ISNUMBER( -  MID(A3,ROW(INDIRECT( 1: &安培; LEN(A3))),1))* ROW(INDIRECT( 1: &安培; LEN (A3))),ROW(INDIRECT( 1: &安培; LEN(A3))))+ 1,1)* 10 ^ ROW(INDIRECT( 1: &安培; LEN(A3)))/ 10) 

数组公式的SCE。



如果可能的话,我宁愿在宏上使用一个公式。



哦,如果它使用Excel 2010有所不同。

解决方案

零售商(B2):

  = LEFT(RIGHT LEN(A2)-FIND(=,A2)),FIND(&,RIGHT(A2,LEN(A2)-FIND(=,A2))) -  1)

猫号(C2):

  = RIGHT(A2,LEN(A2) - (FIND(cat =,A2)+3))

拖动公式,




I'm trying to pull a number out of the middle of a string of text in excel. the string is a mixtire of alpha, numeric and some characters.

Example data string:-

Web Address 
/products_list.php?retailer=8&cat=43
/products_list.php?retailer=22&cat=43
/products_list.php?retailer=8&cat=1011
/products_list.php?retailer=81&cat=1023
/products_list.php?retailer=147&cat=1224
/products_list.php?retailer=8&cat=1
/products_list.php?retailer=147&cat=4
/products_list.php?retailer=147&cat=401

What i want to achieve is

I got as far as pulling out all the numbers from the text but really couldn't work out how to just get the numbers in the middle or the ones at the end.

My attempted code to fix the issue was:-

=SUM(MID(0&A3,LARGE(ISNUMBER(--MID(A3,ROW(INDIRECT("1:"&LEN(A3))),1))*ROW(INDIRECT("1:"&LEN(A3))),ROW(INDIRECT("1:"&LEN(A3))))+1,1)*10^ROW(INDIRECT("1:"&LEN(A3)))/10)

SCE for an array formula.

If possible, I would prefer a formula over a macro.

oh in case it makes a difference im using Excel 2010.

解决方案

Retailer (B2):

=LEFT(RIGHT(A2,LEN(A2)-FIND("=",A2)),FIND("&",RIGHT(A2,LEN(A2)-FIND("=",A2)))-1)

Cat Number (C2):

=RIGHT(A2,LEN(A2)-(FIND("cat=",A2)+3))

drag the formula down and

这篇关于从一串文本中提取数字 - Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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