XLOOKUP 在 Google Sheets 中仅在具有搜索值的第一行上运行。

huangapple go评论79阅读模式
英文:

XLOOKUP in Google Sheets works only on the first line with the searched value

问题

我在Google表格中填充整个表格的过程中遇到了问题。我想要根据A2单元格中的一个产品名称提取所有的数据行。

我已经创建了这样的公式,它从另一个工作表中获取数据并提供我们所搜索的详细信息。基于这个基础,我想要查找所有的详细信息。

我在B5单元格中使用的公式如下:

=xlookup($A$2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201","SKUDatabase!B:B"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201","SKUDatabase!A:A"))

尽管xlookup完美地从第一行中提取了数据,但它无法查找相同产品(在这种情况下是Sausage)的新数据行。当我拖动公式时,唯一发生的事情是复制相同的数据,而不是添加具有不同产品详细信息的新行。

你能帮忙重新制定这个公式,以便它可以根据一个包含产品名称的单元格提取所有的详细信息吗?

英文:

I've got a problem with populating whole table in Google sheets. I want to pull out all the data rows based on one product name from A2 cell.

I've created such formula, which taking the data from another sheet and give us searched details.
From such base I want to look up all the details enter image description here

Formula I used in B5 cell is
enter image description here

=xlookup($A$2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201","SKUDatabase!B:B"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201","SKUDatabase!A:A"))

Although the xlookup perefctly pulls out the data for the first row it can't look up for the new next data row of the same product (Sausage in this case). As I drag the formula down, only what is done is copying the same data, not adding the new rows with different product details.
enter image description here

Could you please help how to remake the formula as it can pull out all of the details based on one cell with product name?

答案1

得分: 0

要实现根据产品名称从一个单元格中拉出所有细节的期望结果,您可以使用FILTER函数和IMPORTRANGE函数。FILTER函数将允许您根据产品名称筛选行,而IMPORTRANGE将从其他工作表中获取数据。以下是您可以在单元格B5中使用的公式:

=FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201", "SKUDatabase!A2:C"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201", "SKUDatabase!A2:A") = $A$2)

此公式将从“SKUDatabase”工作表中提取所有列A、B和C的行,其中列A中的产品名称与单元格A2中的值匹配。确保用正确的Google Sheets文档URL替换URL。还要确保IMPORTRANGE函数具有访问来自其他工作表的数据的权限。当您拖动公式时,它将填充与单元格A2中的产品名称匹配的不同产品细节的行。

英文:

To achieve your desired result of pulling out all the details based on one cell with the product name, you can use the FILTER function along with IMPORTRANGE. The FILTER function will allow you to filter the rows based on the product name, and IMPORTRANGE will fetch the data from the other sheet. Here's the formula you can use in cell B5:

=FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201", "SKUDatabase!A2:C"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/1O1AF3JewmhEoly_dhFWbkax-T5Q7oeQKYjia-Ci1vd0/edit#gid=201", "SKUDatabase!A2:A") = $A$2)

This formula will pull out all the rows from columns A, B, and C in the "SKUDatabase" sheet where the product name in column A matches the value in cell A2. Make sure to replace the URL with the correct URL of your Google Sheets document. Also, make sure that the IMPORTRANGE function has permission to access the data from the other sheet. When you drag the formula down, it will populate the rows with different product details that match the product name in cell A2.

huangapple
  • 本文由 发表于 2023年7月24日 19:33:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76754063.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定