Как запросить выбор нескольких столбцов, если столбцы <> '' и Col1 содержит «строку» - PullRequest
0 голосов
/ 14 января 2020

Импорт с листа: 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 <>''"))

1 Ответ

1 голос
/ 14 января 2020

вам нужно сделать это следующим образом:

=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

...