如何将使用ImportJSON导入的值转换为数值?

问题描述 投票:0回答:2

我发现使用ImportJSON导入Google Spreadsheets的值不是数字。它们是文本(现在对我来说是显而易见的),不能进行总结。

如何转换?我尝试将“单元格格式”更改为数字,但无济于事。

导入是

=ImportJSON("https://api.liquid.com/executions?product_id=1&limit=10")

我希望对第四列“模型数量”求和,但总数为零。

arrays json google-sheets array-formulas importjson
2个回答
0
投票

知道了! RegEx再次解救。

=ArrayFormula(REGEXREPLACE(D2:D11, "[^\d\.]+",)*1)

然后将所得的新的数值列求和。

来源:How to Convert Currency Text to Number in Google Sheets

注意:您必须更改示例中使用的花式双引号。


0
投票

尝试:

=INDEX(IMPORTJSON("https://api.liquid.com/executions?product_id=1&limit=10")*1)

或如果您看到错误:

=INDEX(IFERROR(
 IMPORTJSON("https://api.liquid.com/executions?product_id=1&limit=10")*1;     
 IMPORTJSON("https://api.liquid.com/executions?product_id=1&limit=10")))
© www.soinside.com 2019 - 2024. All rights reserved.