简体   繁体   English

错误。 在文本字符串中查找数字的 position。 (Excel 2016 公式)

[英]Error! Finding the position of the number in a Text String. (Excel 2016 Formula)

So below are two different text strings.所以下面是两个不同的文本字符串。 I am trying to get the position of four digit number which is a dynamic number in every text string (8555) to extract the store name (Amazing Stores 2584 or what ever is in that place again dynamic no fixed width so can't use =right).我正在尝试获取四位数的 position,这是每个文本字符串 (8555) 中的动态数字,以提取商店名称(Amazing Stores 2584 或那个地方的任何东西再次动态没有固定宽度所以不能使用 =正确的)。


04/12/2022 13:01:00 00 K 18.30 18.30 USD 926 4 DLKY 1 000 05 8555 0 AMAZING STORES 2584 02/12/2022 13:01:00 00 K 18.30 18.30 USD 926 4 DLKY 1 000 05 8555 0 AMAZING STORES 04/12/2022 13:01:00 00 K 18.30 18.30 USD 926 4 DLKY 1 000 05 8555 0 令人惊叹的商店 2584 02/12/2022 13:01:00 00 K 18.30 18.30 USD 926 4 DLKY 0 A850ZING 05 05 05 ZING商店


Now my formula works for the second text string but not for the first.现在我的公式适用于第二个文本字符串,但不适用于第一个。 even thought everything is similar with just a change in date (04 instead of 02) and a number after store ie (Amazing Stores 2584)甚至认为一切都相似,只是日期发生变化(04 而不是 02)和商店后的数字,即(Amazing Stores 2584)

Workflow to find the first character of the Four digit number & Store Name查找四位数字和商店名称的第一个字符的工作流程

Formula Used: =FIND(LOOKUP(10^15,MID(A2,ROW(INDIRECT("1:"&LEN(A2))),5)+0),A2)+6 in cell b1 Formula Len: =len(a1) in cell c1 Final Result: = right(a1,c1-b1) to extract the store name.使用的公式: =FIND(LOOKUP(10^15,MID(A2,ROW(INDIRECT("1:"&LEN(A2))),5)+0),A2)+6 在单元格 b1公式 Len 中: =len( a1) in cell c1 Final Result: = right(a1,c1-b1) 提取商店名称。

**Few things to note: ** **需要注意的几点:**

  1. I can't convert text to columns so this option wont work我无法将文本转换为列,因此此选项不起作用
  2. There is no Fixed length its dynamic as data is dynamic由于数据是动态的,因此没有固定长度的动态
  3. The Start position cannot be fixed length so can't use mid function either as amount could differ Start position 不能固定长度,因此不能使用 mid function,因为数量可能不同
  4. Text Split not an option as i can only use excel 2016 for this project文本拆分不是一个选项,因为我只能为此项目使用 excel 2016

I am fairly new to excel so Any help from you experts is greatly appreciated.我是 excel 的新手,非常感谢各位专家的帮助。 Thanks.谢谢。

Tried using multiple formula's and spent close to hours on trying to figure this out on my own, Please help me.尝试使用多个公式,并花了将近几个小时试图自己解决这个问题,请帮助我。

So I would go with either:所以我会 go 与:

FIND(8555,A1,1)

Or要么

FIND("8555 0",A1,1)

Both return the position of the start of 8555. The first one looks for the number, while the second looks for the number, space, 0. Both return the start position.两者都返回 8555 开头的 position。第一个查找数字,而第二个查找数字,空格,0。两者都返回开头 position。

Then I would use find() to get the position of the second space, assuming that all store names have a space in them, if not you need to just find the positon of the next space.然后我会使用 find() 来获取第二个空格的 position,假设所有商店名称中都有一个空格,如果没有,您只需要找到下一个空格的位置。

As far not being able to use mid(), you can by using find() to define the start position of mid() and also the end position based on finding the position of spaces AFTER "8555 0".由于无法使用 mid(),您可以使用 find() 来定义 mid() 的开始 position 以及基于找到“8555 0”之后的空格 position 的结束 position。

=MID(A1,
     FIND(" "&MATCH(10^15,FIND(TEXT(ROW($1:$9999),"0000"),A1))&" ",A1)+7,
     LEN(A1))

This avoids using the volatile INDIRECT function and finds the position of the first 4 digit number surrounded by a space character and adds 7 to get the start position of the store name.这避免了使用 volatile INDIRECT function 并找到由空格字符包围的前 4 位数字的 position 并添加 7 以获得商店名称的开头 position。 Than it will add all characters from there.它将从那里添加所有字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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