首页 > 解决方案 > Google Sheets Importrange statement in SWITCH

问题描述

I'm using the importdata statement inside in Switch condition and it does not return anything nor give an error.

My formula:

=SWITCH(C5,"Desired Value",IMPORTRANGE("url to the google spreadsheet", "MyTab!A:E"),C5,"Another Value","Another Value Output")

So when it's "Desired Value" is prints nothing. If I write a separate IMPORTRANGE without SWITCH it works fine.

EDIT:

Example

Source File (from what I'm importing) link and the file with SWITCH statement link

标签: if-statementgoogle-sheetsswitch-statementgoogle-sheets-formulaimportrange

解决方案


删除SWITCH并使用IF如下:

=IF(B1="Tab1", IMPORTRANGE("19csOm3txsZ-RAUiDYbEJLmWUsm5b-Qk9vkMMdJZ6CqM", "TAB1!A1:A19"),
 IF(B1="Tab2", IMPORTRANGE("19csOm3txsZ-RAUiDYbEJLmWUsm5b-Qk9vkMMdJZ6CqM", "TAB2!A1:A19"), ))

0


推荐阅读