如何用 SUBSTITUTE 公式替换 Excel 中的引号?
我有工作表,其中需要命名范围来对应于另一个单元格的内容。单元格中的文本类似于:
Partitions w Studs 16" oc
命名范围不能有空格,或者最重要的是,像“这样的特殊字符。因此,范围的命名如下:
PartitionswStuds16oc
要将前者更改为对工作表中后者的引用,我可以处理使用以下公式删除空格:
=SUBSTITUTE(B1," ","")
但是,我无法替换 "
因为双引号用于指定公式中的文本。 Excel 无法按预期解析以下公式:
=SUBSTITUTE(SUBSTITUTE(B1," ",""),""","")
有关如何解决此问题的任何提示?我知道我可以将文本更改为 16-in.
而不是 16"
,但如果可能的话,我想按照客户的要求保留它。
I have worksheet where I need named ranges to correspond to the contents of another cell. The text in the cell is something like:
Partitions w Studs 16" oc
Named ranges cannot have spaces, or most importantly, special characters like ". So, the range is named the following:
PartitionswStuds16oc
To change the former into a reference to the latter in the worksheet, I can handle removing the spaces with the following formula:
=SUBSTITUTE(B1," ","")
I cannot, however, substitute the "
because the double-quotation mark is used to specify text in the formula. Excel can't parse the following formula, as expected:
=SUBSTITUTE(SUBSTITUTE(B1," ",""),""","")
Any tips on how to get around this? I know I could change the text to say 16-in.
instead of 16"
, but I want to keep it as my client requested if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
""""
转义"
:""""
escapes a"
:尝试使用
CHAR(34)
代替“:Try using
CHAR(34)
as substitute for ":要在带引号的字符串中使用双引号,只需将它们加倍即可。在您的情况下,这会产生四个连续的双引号:
To use double qutoes within a quoted string, just double them. In your case, this results in four consecutive double quotes: