如果列<>''和Col1包含“字符串”,如何查询选择多列]

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

从工作表导入:https://docs.google.com/spreadsheets/d/1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw/edit?usp=sharing

导入到工作表:https://docs.google.com/spreadsheets/d/1n6gHMv_R8sipeY7PbLbgLYde2o66NM-v-_KL8k_mmug/edit?usp=sharing

从工作表导入:enter image description here

导入到工作表:enter image description here

如果满足此条件,我将尝试选择导入到1列的多个单元格:

Col1 = Maintenance:
Col3 is not <>''
Col12 is not <>''
Col21 is not <>''
Col30 is not <>''

尽管在删除查询中的空白单元格时遇到了一些麻烦。

=TRANSPOSE(QUERY({Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 1-4'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 5-8'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 9-12'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 13-16'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 17-20'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 21-24'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 25-28'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 29-32'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 33-36'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 37-40'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 41-44'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 45-48'!B97:AL162");
Importrange("1-CDuKq2ueygE8qLdV6EH1eeXT9NSYYG8N_k4XqDEtdw","'Week 49-52'!B97:AL162")},
"SELECT Col3, Col12, Col21, Col30 where Col1 contains 'Maintenance:' and Col3, Col12, Col21, Col30 is not <>''"))
google-sheets google-sheets-formula google-sheets-query google-query-language importrange
1个回答
1
投票

您需要这样做:

=TRANSPOSE(QUERY({
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 1-4'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 5-8'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 9-12'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 13-16'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 17-20'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 21-24'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 25-28'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 29-32'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 33-36'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 37-40'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 41-44'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 45-48'!B97:AL162");
Importrange("1Pf4NwDDpKnRcn16SPNwpIJsJZMB0ISfOtpsaIkaiZwM","'Week 49-52'!B97:AL162")},
"select Col3,Col12,Col21,Col30 
 where Col1 contains 'Maintenance:' 
   and Col3 is not null
   and Col12 is not null
   and Col21 is not null
   and Col30 is not null"))

或根据需要使用or代替and

0

© www.soinside.com 2019 - 2024. All rights reserved.