简体   繁体   English

如何在Excel中从多个条件返回多个匹配项的列标题?

[英]How to return the column heading for multiple matches, from multiple criteria, in Excel?

I'm working with 40+ price lists for different groups of customers. 我正在为40多个价目表针对不同的客户群。 By entering the item number and price, I'd like to show the names of all the price lists that match that item/price. 通过输入商品编号和价格,我想显示与该商品/价格匹配的所有价格清单的名称。 I've set up the items and pricing lists like the table below. 我已经设置了项目和价格清单,如下表所示。 Some items have the same prices in multiple price lists, and some price lists do not list all items. 有些项目在多个价格表中具有相同的价格,而某些价格表未列出所有项目。

Item     ListPrice  Red    Blue   Green    Grey
Hosaka2  $200       $180   $188            $171
TrodesH  $460       $410   $380   $400     $380
TrodesL  $810       $680   $680   $720
Shuri    $80        $72           $72      $70

I'd like to enter TrodesH and $380 into cells and have the formula return Blue & Grey. 我想在单元格中输入TrodesH和$ 380,并让公式返回Blue&Grey。 Or enter Hosaka2 and $200 and have the formula return ListPrice. 或输入Hosaka2和$ 200并让公式返回ListPrice。

I've used this Index array formula in the past to return multiple matches to a single entry. 我过去曾使用过这个Index数组公式来将多个匹配项返回到单个条目。 To, for example, list all the account numbers whose address matches the zip code I enter. 例如,要列出地址与我输入的邮政编码匹配的所有帐号。 It's very handy. 非常方便。 But here I'm looking for the combination of item and price. 但是在这里,我正在寻找商品和价格的组合。 Any ideas how I might move forward? 有什么想法可以前进吗?

Edit: For better legibility in the Excel file, I've placed the above data in a worksheet named "Matrix" and the lookup formulas in a worksheet named "Check." 编辑:为了使Excel文件更易读,我将上述数据放在了名为“矩阵”的工作表中,并将查找公式放在了名为“检查”的工作表中。

Let's assume that A1:F5 contains the data, and H2 contains the item of interest, such as TrodesH, and I2 contains the price of interest, such as $380, try... 假设A1:F5包含数据,H2包含感兴趣的商品,例如TrodesH,I2包含感兴趣的价格,例如$ 380,请尝试...

J2:

=COUNTIF(INDEX($B$2:$F$5,MATCH($H2,$A$2:$A$5,0),0),$I2)

K2, confirmed with CONTROL+SHIFT+ENTER, and copied across:

=IF(COLUMNS($K2:K2)<=$J2,INDEX($B$1:$F$1,SMALL(IF(INDEX($B$2:$F$5,MATCH($H2,$A$2:$A$5,0),0)=$I2,COLUMN($B$1:$F$1)-COLUMN($B$1)+1),COLUMNS($K2:K2))),"")

Hope this helps! 希望这可以帮助!

Taking the diagram below as a model (adjust it to your own data layout and places), you can enter this formula at J1 and copy/paste into the colored area: 以下图为模型(根据您自己的数据布局和位置进行调整),可以在J1处输入此公式,然后将其复制/粘贴到彩色区域:

J1:
=IFERROR(INDEX($1:$1,AGGREGATE(15,6,COLUMN($B$2:$F$5)
  /($A$2:$A$5=$H1)/($B$2:$F$5=$I1),COLUMN(A:A))),"")

在此处输入图片说明

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

相关问题 筛选具有多个条件和部分匹配项的对象数组 - Filter an Array of Objects with Multiple Criteria and Partial Matches Excel在具有多个条件的数组中计数 - Excel count in array with multiple criteria 具有多个数组条件的Excel SUM IF - Excel SUM IF with multiple array criteria Excel Match Multiple Criteria Lookup Array:从列表中查找包含所有值的列,并返回数组中的列 position - Excel Match Multiple Criteria Lookup Array: Find columns that contains all values from a list and return the columns position in the array 有效的Excel公式,可从大量行中返回多个匹配项 - Efficient Excel formula for returning multiple matches from a large number of rows 如何从多个数组的匹配中创建一个对象 - How to create an object from the matches of multiple arrays 如何选择多个条件以返回与这些条件匹配的一个对象 - How to select for multiple conditions to return one object that matches those conditions 如何在数组中返回多个值 - Excel VBA - How to return multiple values in an Array - Excel VBA Excel 是否可以根据有多个匹配项的唯一键查找记录的数据,但根据条件仅返回一条记录? - Can Excel Lookup data for a record based on a unique key where there are multiple matches, but return only 1 record based on a condition? SUMIF / SUMIFS的Excel SUM具有动态多个条件 - Excel SUM of SUMIF/SUMIFS with dynamic multiple criteria
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM