如何用 SUBSTITUTE 公式替换 Excel 中的引号?

发布于 2024-11-01 21:56:46 字数 520 浏览 0 评论 0原文

我有工作表,其中需要命名范围来对应于另一个单元格的内容。单元格中的文本类似于:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

宛菡 2024-11-08 21:56:46

"""" 转义 "

=SUBSTITUTE(SUBSTITUTE(B1," ",""), """", "")

"""" escapes a ":

=SUBSTITUTE(SUBSTITUTE(B1," ",""), """", "")
紫南 2024-11-08 21:56:46

尝试使用 CHAR(34) 代替“:

=SUBSTITUTE(B1,CHAR(34),"")

Try using CHAR(34) as substitute for ":

=SUBSTITUTE(B1,CHAR(34),"")
乞讨 2024-11-08 21:56:46

要在带引号的字符串中使用双引号,只需将它们加倍即可。在您的情况下,这会产生四个连续的双引号:

=SUBSTITUTE(B1,"""","")

To use double qutoes within a quoted string, just double them. In your case, this results in four consecutive double quotes:

=SUBSTITUTE(B1,"""","")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文