使用带有两个查找值的 VLOOKUP,同时使用 IMPORTRANGE 合并三个 Google 工作表

Using VLOOKUP with two lookup values while using IMPORTRANGE to merge three Google Sheets

我创建了三个 google sheet,其中一个 google sheet 被设计为另外两个 google 上存在的数据的主文件sheets.

我能够使用以下公式将两个 google sheets 数据合并到主文件中:

=QUERY({IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs","Sheet1!A2:H");IMPORTRANGE("12I5uRLkS_YjgWPdf_Kx5orQxX876XruW9Q9kDrECJi0","Sheet1!A2:H")},"WHERE Col2 IS NOT NULL ORDER BY Col1 ASC")

但是,我现在想做的是在使用基于两个查找值的 VLOOKUP 的同时使用 IMPORTRANGE 将数据导入另一个。这是我在该特定列上使用的公式,它 returns 给我一个错误“VLOOKUP 计算结果超出范围":

=ARRAYFORMULA(VLOOKUP(A2&" "&B2, {IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", {Sheet1!$A:$A&" "&Sheet1!$B:$B,Sheet1!$F:$F});IMPORTRANGE("12I5uRLkS_YjgWPdf_Kx5orQxX876XruW9Q9kDrECJi0", {Sheet1!$A:$A&" "&Sheet1!$B:$B,Sheet1!$F:$F})},5,false))

我能够在仅使用一个查找值的情况下测试相同的公式,请参阅下面仅一个查找值的工作公式:

=ARRAYFORMULA(VLOOKUP(A2, {IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!A2:F");IMPORTRANGE("12I5uRLkS_YjgWPdf_Kx5orQxX876XruW9Q9kDrECJi0", "Sheet1!A2:F")},6,false))

导入范围内不支持多范围。使用:

=ARRAYFORMULA(IFNA(VLOOKUP(A2&" "&B2, {
 IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!A2:A")&" "&
 IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!B2:B"),
 IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!F2:F")}, 2, )))

对于两个导入范围,它将是:

=ARRAYFORMULA(IFNA(VLOOKUP(A2&" "&B2, {
 IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!A2:A")&" "&
 IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!B2:B"),
 IMPORTRANGE("1JY2OMkBa926_P_PJABMxFqctfnRQAPAknkvMzFn7lFs", "Sheet1!F2:F"); 
 IMPORTRANGE("12I5uRLkS_YjgWPdf_Kx5orQxX876XruW9Q9kDrECJi0", "Sheet1!A2:A")&" "&
 IMPORTRANGE("12I5uRLkS_YjgWPdf_Kx5orQxX876XruW9Q9kDrECJi0", "Sheet1!B2:B"),
 IMPORTRANGE("12I5uRLkS_YjgWPdf_Kx5orQxX876XruW9Q9kDrECJi0", "Sheet1!F2:F")}, 2, )))

还请确保在使用上述任何公式之前运行首先通过允许访问连接您的工作表