英文:
Use GS Query() to convert text value into a number
问题
考虑一个表格,其中列A是与列B相关联的实体。列B包含文本格式的数字(例如,3.0000是文本)。
我尝试了以下查询:
=QUERY(range_name,"SELECT A, VALUE(B)",0).
我还尝试了这个查询:
=QUERY(range_name,"SELECT A, B*1",0).
都不起作用。在Google表格中,我可以通过乘法(B*1)来转换它,但我更喜欢在查询中进行此操作。
有什么想法吗?我将SQL和Google表格标记为标签,尽管在GS中有很多SQL函数不起作用。
谢谢。
英文:
Consider a table, in which column A is an entity associated with column B. And column B contains numbers in text formats (e.g., 3.0000 is a text).
I've tried this query:
=QUERY(range_name,"SELECT A, VALUE(B)",0).
I've also tried this query:
=QUERY(range_name,"SELECT A, B*1",0).
Neither works. I'm able within google sheets to convert it by multiplying (B*1), but I'd prefer to do this within the query.
Any ideas? I'm tagging SQL as well as google sheets, though quite a few SQL functions don't work in GS.
Thanks.
答案1
得分: 0
=QUERY({A:A,INDEX(VALUE(B:B)}, "选择 Col1, Col2", 0)
显然,如果你只需要数据而不需要进一步处理,你可以去掉 "选择 Col1, Col2" 部分。
英文:
If you do it inside the range?
=QUERY({A:A,INDEX(VALUE(B:B))},"Select Col1, Col2",0)
Obviously if you just need the data without any further processing, you can get rid of "Select Col1, Col2" part
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论