简体   繁体   English

Excel 公式 - 通过匹配源单元格连接多个单元格的标准

[英]Excel Formula - Criteria To Concatenate multiple cells by matching source cell

I am Looking to concatenates multiple cells into one by Index-matching the criteria我希望通过索引匹配标准将多个单元格连接成一个单元格

The below formula is not pulling in all the required UPCs against the specified criteria以下公式并未根据指定标准提取所有必需的 UPC

 =INDEX($B:$B,MATCH($D:$D,$A:$A,0))

I would like the end result to look like COL E2 in the below image with semi-colons in between every value ;我希望最终结果看起来像下图中的 COL E2,每个值之间都有分号;

在此处输入图像描述

Any help here would be much appreciated.在这里的任何帮助将不胜感激。

If you have Office365 then use TEXTJOIN() with FILTER() function.如果你有Office365然后使用TEXTJOIN()FILTER() function。

=TEXTJOIN(";",TRUE,FILTER($B$2:$B$15,$A$2:$A$15=D2))

Edit: Assuming you don't have access to O365 dynamic formulas.编辑:假设您无权访问O365动态公式。 Then try below array formula.然后尝试下面的数组公式。

=TEXTJOIN(";",TRUE,IF($A$2:$A$15=D2,$B$2:$B$15,""))

Press CTRL + SHIFT + ENTER to evaluate the formula as it is an array formula.CTRL + SHIFT + ENTER计算公式,因为它是一个数组公式。

在此处输入图像描述

An alternative approach using the CONCAT function:使用CONCAT function 的另一种方法:

=CONCAT(FILTER(B:B, A:A=D2)&";")

Explanation:解释:

  1. The FILTER logic is just like Harun24HR suggested. FILTER逻辑就像 Harun24HR 建议的那样。 Creating an array of all the values in B where the value in A is equal to D2.创建一个包含 B 中所有值的数组,其中 A 中的值等于 D2。
  2. The & operator works on each element in the array and adds a delimiter ";" & 运算符作用于数组中的每个元素并添加分隔符“;” to each value.到每个值。
  3. Finally, the CONCAT function combines all of the elements in the array into a single string.最后, CONCAT function 将数组中的所有元素组合成一个字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM