如何根据一个条件提取多个值?

时间:2019-06-24 14:29:33

标签: google-sheets transpose google-sheets-formula array-formulas google-sheets-query

我目前有一个数据库,如下所示:

enter image description here

但是我希望数据库的输出看起来像这样:

enter image description here

我尝试使用const formData = new FormData(); const fileMetadata = {filename: fileName, contentType: 'image/png', knownLength: fs.statSync(pathToFile)}; const formData.append('file', fs.createReadStream(pathToFile), fileMetadata); fetch(url, {method: 'POST', body: formData}); INDEX,但是我一直找不到从输出中排除空白值的方法。

我使用过但未完全返回预期输出的公式是:

MATCH

是否有一个公式可以连续返回非空白值,如输出表所示?

https://docs.google.com/spreadsheets/d/1HdkBPhzB5oZ0RyKZzAOkPIXT81upgHiGBLfgXsrOZDI/edit?usp=sharing

1 个答案:

答案 0 :(得分:2)

=ARRAYFORMULA({UNIQUE(FILTER('Input sheet'!A2:A, 'Input sheet'!A2:A<>"")), TRIM(SPLIT(
 TRANSPOSE(QUERY(IF(QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRIM(TRANSPOSE(QUERY(
 TRANSPOSE(IF(LEN('Input sheet'!B2:J), "♠"&'Input sheet'!A2:A&"♦"&'Input sheet'!B1:J1, ))
 ,,999^99))),,999^99), "♠")), "♦")),
 "select count(Col2) where Col2 is not null group by Col2 pivot Col1",0), "offset 1",0)<>"",
 QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRIM(TRANSPOSE(QUERY(
 TRANSPOSE(IF(LEN('Input sheet'!B2:J), "♠"&'Input sheet'!A2:A&"♦"&'Input sheet'!B1:J1, ))
 ,,999^99))),,999^99), "♠")), "♦")),
 "select Col2,count(Col2) where Col2 is not null group by Col2 pivot Col1", 0), 
 "select Col1 offset 1", 0)&"♥", ),,999^99)), "♥"))})

0


以上所述:

=ARRAYFORMULA(TRANSPOSE(QUERY(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(LEN('Output sheet'!B2:F), "♠"&'Output sheet'!A2:A&"♦"&'Output sheet'!B2:F, ))
 ,,999^99)),,999^99)), "♠")), "♦"), 
 "select Col2,count(Col2) where Col2 is not null group by Col2 pivot Col1", 0)))

0