[英]Google Sheets Converting numbers imported from a different country, switching commas with periods
I'm importing numbers represented with commas instead of dots, and dots instead of commas, in Google sheets, and I need to convert them: from我在 Google 工作表中导入用逗号而不是点表示的数字,以及用点而不是逗号表示的数字,我需要转换它们:从
32.072,25 to 32072.25
-1,06 to -1.06
For now I'm doing it with two nested RegExReplace expressions现在我用两个嵌套的 RegExReplace 表达式来做
REGEXREPLACE( REGEXREPLACE( B2, "\.","" ),
",", "\." )
I believe that it could be done without nesting, as part of the same RegEx operation, but I'm not knowledgeable enough about the RegEx syntax and logic to find a way.我相信它可以在没有嵌套的情况下完成,作为同一个 RegEx 操作的一部分,但我对 RegEx 语法和逻辑的了解还不足以找到一种方法。 Is it possible at all?有可能吗?
try:尝试:
=IF(REGEXMATCH(""&B2, "[.]"),
SUBSTITUTE(SUBSTITUTE(B2, ".", ), ",", "."), SUBSTITUTE(B2, ",", "."))
to get numeric values:获取数值:
=1*IF(REGEXMATCH(""&B2, "[.]"),
SUBSTITUTE(SUBSTITUTE(B2, ".", ), ",", "."), SUBSTITUTE(B2, ",", "."))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.