【问题标题】:Match key/values within unique ID range to a different matching key将唯一 ID 范围内的键/值匹配到不同的匹配键
【发布时间】:2019-07-04 15:58:21
【问题描述】:

Shopify 最近添加了一项功能,允许将产品图片与产品变体相关联。他们使用新列更新了产品导入/导出功能,允许您将图像 URL 与特定变体相关联。

这是一个抽象的简化外观:

handle      option  img url     img atl   option img url
---------------------------------------------------------------------
unique-1    blue    URLblue1    blue      wanted value: URLblue1
unique-1    blue    URLred1     red       wanted value: URLblue1
unique-1    red     URLgreen1   green     wanted value: URLred1 
unique-1    red                           wanted value: URLred1
unique-1    green                         wanted value: URLgreen1
unique-1    green                         wanted value: URLgreen1
unique-2    blue    URLblue2    blue      wanted value: URLblue2
unique-2    blue    URLred2     red       wanted value: URLblue2
unique-2    red     URLgreen2   green     wanted value: URLred2
unique-2    red                           wanted value: URLred2
unique-2    green                         wanted value: URLgreen2
unique-2    green                         wanted value: URLgreen2

我写“想要的价值”的地方是电子表格上的空白列。我正在寻找某种可以放在该列中的公式来得出想要的值。

【问题讨论】:

  • 该解决方案是否必须在 MS Excel 或 Google 表格中工作,或两者兼而有之?

标签: google-sheets google-sheets-formula array-formulas


【解决方案1】:

这仅适用于 Google 表格,并且应该放在 E2 中,假设您的第一个想要的值在 E2 中:

=ArrayFormula(IFERROR(HLOOKUP(C1,C:C,VLOOKUP(A2:A,QUERY({A2:D,ROW(A2:A)},"select Col1, min(Col5) where Col4 != '' group by Col1 pivot Col4"),MATCH(B2:B,SORT(UNIQUE(D2:D)),0)+1,0),0)))

它还假设我已经正确解释了您的抽象,所以如果它在您的实际数据上失败,请报告。

【讨论】:

  • 它没有用。这是一个包含更具体数据的可读电子表格的链接。 docs.google.com/spreadsheets/d/… 我更改了它,使 E 列现在是 C 列,紧挨着 B 列,其中 url 最终应该排在后面两个。句柄范围(A 列)基本上定义了每个产品,并且图像 url 和图像 alt 与实际行有点独立,只要它们的值与产品句柄(A 列)包含在一行中
  • 对于那个布局,试试=ArrayFormula(IFERROR(HLOOKUP(D1,D:D,VLOOKUP(A2:A,QUERY({A2:A,D2:E,ROW(A2:A)},"select Col1, min(Col4) where Col3 != '' group by Col1 pivot Col3"),MATCH(B2:B,SORT(UNIQUE(E2:E)),0)+1,0),0)))
  • 该公式放在哪里?
  • 在C2中输入。
  • 我在我发布的工作表链接的上下文中使用了旧公式,并且这些值按照我无法破译的模式进行了置换。 imgur.com/A0sXCWm
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多