简体   繁体   English

Google 表格转换从不同国家/地区导入的数字,用句点切换逗号

[英]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.

相关问题 如何在 Google 表格中将导入的数据从小数更改为逗号? - How do I change imported data from decimals to commas in Google Sheets? Google表格将日期转换为数字 - Google Sheets converting dates to numbers Google表格十进制数,如何删除逗号并添加零 - Google Sheets Decimal Numbers, how to remove commas and add zero 在 Google 表格中使用数据验证仅允许使用数字、逗号和空格 - Using Data Validation in Google Sheets to only allow numbers, commas and spaces 从 Google 表格中的单元格中提取不同格式的数字 - Extracing numbers in different formats from cells in Google Sheets 如何阻止 Google Sheets 将括号中的数字转换为负数? - How to stop Google Sheets converting numbers wrapped in parentheses to negative numbers? 从Google表格中的纬度和经度中获取城市,州,国家/地区 - Get City, State, Country from Latitude and Longitude in Google Sheets 从 Google 表格中的链接中提取带有协议和国家/地区代码的域 - Extract domain with protocol and country code from the link in Google Sheets 从单元格中获取数字(Google表格) - Take numbers from a cell (Google sheets) 从 Google 表格上的文本中提取特定数字? - Extracting Specific numbers from text on Google Sheets?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM