Google表格公式将列添加到数组吗?

问题描述 投票:1回答:1

在Google表格中,我有一个二维数组,其大小无法预测,由查询返回:

08-02-2020 | Red
10-02-2020 | Brown
12-02-2020 | Green

现在,我想向数组添加包含常量“ Golf”的第三列。例如:

08-02-2020 | Red   | Golf
10-02-2020 | Brown | Golf
12-02-2020 | Green | Golf

是否可以将列添加到初始数组?无法用arrayformula驯服...

当前查询:

=query(transpose(query(transpose(query(transpose(query(A1:11)),"select * where Col1 > 0")),"select * where Col1 <> ''",1)),"select * where Col2 > 0")
arrays google-sheets transpose array-formulas google-sheets-query
1个回答
1
投票

尝试:

=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(QUERY(TRANSPOSE(QUERY(A1:11)), 
 "where Col1 > 0")), 
 "where Col1 <> ''", 1)), 
 "select "&TEXTJOIN(",", 1, "Col"&TRANSPOSE(ROW(INDIRECT("A1:A"&COLUMNS(
 QUERY(TRANSPOSE(QUERY(TRANSPOSE(QUERY(TRANSPOSE(QUERY(A1:11)), 
 "where Col1 > 0")), "where Col1 <> ''", 1)), 
 "where Col2 > 0"))))), "'Golf'")&" where Col2 > 0"))
© www.soinside.com 2019 - 2024. All rights reserved.