在单个单元格中查找多个值(逗号分隔),然后 return 将值添加到单个单元格(也以逗号分隔)

Lookup multiple values in a single cell (comma separated) and then return the values to a single cell (also comma separated)

使用 Google 表格,我有以下两个 table:

第一 table

Size   | Code
--------------
Large  | L
Small  | S
XLarge | XL

第 2 table

Values       | Codes
-------------------
Large,Small  | L,S
XLarge,Small | XL,S
XLarge,large | XL,L

我需要在 Codes 列上查找函数以 return 相应值的代码。

当我使用:

=LOOKUP(Values Column,Size,Code)

我只有一个代码例如L。 我怎样才能得到代码: (长, 小) (XL,S) (XL,L) 等?

您可以尝试查询。如果 table 1 在 Sheet1 中,table 2 在 Sheet2 中,则在 Sheet3 中输入要在 A2 中查找的尺寸(即 'S'),然后在 B2 中输入此查询:

 =Query({Sheet1!A2:B4,Sheet2!A2:B4},"Select Col4 where Col4 contains '"&A2&"'")

您必须拆分它们,进行 vlookup,然后连接结果

=arrayformula(left(concatenate(vlookup(split(D2,","),$A:$B,2,false)&","),len(concatenate(vlookup(split(D2,","),$A:$B,2,false)&","))-1))

我的查找 table 在 A2:B4 中,值从 D2 开始。