1

Is there a way of returning part of a string between certain characters in excel? For example my string looks like this:

`switchrefid` = {switchrefid: }

I need to cut the part of the string between the ' (apostrophes) so it just returns switchrefid

I'm sure there must be a formula for this i just cant think of the one to use.

Thanks in advance.

4

2 回答 2

3

只要 ``` 字符在您的数据中恰好出现两次,您就可以:

=LEFT(RIGHT(A1, LEN(A1)-FIND("`", A1)), FIND("`",RIGHT(A1, LEN(A1)-FIND("`", A1)))-1)

虽然它非常可怕!

(编辑:当然,这假设您的数据在 A1 中。)

于 2013-04-24T13:39:29.057 回答
-1

还有两个选项,如果单词总是从第二个字符开始并在最后一个字符之前结束,您可以简单地使用:

=MID(A1,2,LEN(A1)-2) ' Minus 2 for the 2 ticks

第二种选择是用任何类似的东西代替刻度:

=SUBSTITUTE(A1,"`","")

用替身也是支持多个替身。因此,如果您出于某种原因有 `switchrefid` 并且只想摆脱三个刻度中的 2 个,则可以使用:

=SUBSTITUTE(A1,"`","",2)

这将返回 switchrefid`

虽然它不适用于“switchrefid”,因为它仍然会返回 switchrefid,因为它只删除要删除的文本的第 2 个实例

于 2013-04-24T14:06:03.023 回答