简体   繁体   English

Excel公式在两列中搜索一列中的唯一值,在另一列中搜索固定值

[英]Excel formula to search two columns for unique value in one column and fixed value in another

Got status codes in column H (BE, BK, TR, MO) and Serial numbers in column N. My aim is to find rows with duplicate Serial numbers, and mark them out With "unik" on 1 of them and "duplikate" on similar cells/rows BUT at the same time do this only when status codes in H is either "BK" or "BE". 在H列中获得状态代码(BE,BK,TR,MO),在N列中获得序列号。我的目的是查找具有重复序列号的行,并在其中之一上标有“ unik”,并在其中标上“ duplikate”仅当H中的状态代码为“ BK”或“ BE”时,类似的单元格/行BUT才能同时执行此操作。

This is my attempt so far: 到目前为止,这是我的尝试:

=IF(AND((COUNTIF($N$2:$N132,$N132)=1)+0,OR($H$2:$H132="BK",$H$2:$H132="BE")),"bk-be_unik","bk-be_duplikat")

It Works, but only when status code "BE" or "BK" is found at the first row holding a duplicate Serial number. 它有效,但是仅当在第一行找到具有重复序列号的状态代码“ BE”或“ BK”时才有效。 If there are 6 rows holding Serial number "999", and the first row is status code like "MO", the formula give me "duplicate" on all 6 rows. 如果有6行的序列号为“ 999”,并且第一行是状态代码,如“ MO”,则该公式在所有6行中都给我“重复”的信息。

Is there a way to do this so that it will work no matter where the status code I'm searching for is located? 有没有办法做到这一点,无论我要搜索的状态代码在哪里,它都可以工作?

Here is one way of doing this 这是一种方法

在此处输入图片说明

In A2 use formula: A2使用公式:

=IF(SUM(COUNTIFS($N$2:$N$4000,N2,$H$2:$H$4000,{"BK","BE"}))>1,IF(SUM(COUNTIFS($N$2:$N2,N2,$H$2:$H2,{"BK","BE"}))=1,"unik","duplikate"),"")

Reversed order: 倒序:

=IF(SUM(COUNTIFS($N$2:$N$4000,N2,$H$2:$H$4000,{"BK","BE"}))>1,IF(SUM(COUNTIFS($N2:$N$4000,N2,$H2:$H$4000,{"BK","BE"}))=1,"unik","duplikate"),"")

当“ BK”或“ BE”在H列的同一行中时,请尝试使用此方法匹配N列中的序列号。

=IF(sumproduct(COUNTIFs($N$2:$N132, $N132, $H$2:$H132, {"BK", "BE"}))=1, "bk-be_unik", "bk-be_duplikat")

暂无
暂无

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

相关问题 Excel 公式:在列中搜索另一个值(LIKE) - Excel formula: search in column by another value (LIKE) 仅计算两列之间的一个实例,其中第三列在 EXCEL 公式中具有特定值 - COUNT only one instance between two columns where 3rd column have specific value in EXCEL formula excel公式:根据另一列的值在一个列中查找唯一性 - excel formula : Find uniques in one column depending on value of another column Excel公式比较2列并从另一列中提取值 - Excel formula to compare the 2 columns and extract the value from another column Excel:如果函数按两列过滤表,并查看第三列是否具有多个唯一值 - Excel: If function that filters a table by two columns and sees if a third column has more than one unique value 在Excel中,搜索一列以获取存在于另一列的最大值 - In Excel, search one column for highest value that exists that is linked to another column 如何使用 Excel 公式将两列值与另外两列匹配 - How to match two columns value with the another two columns by using Excel Formula 将Excel中的多列转换为具有唯一值的1列 - Turn multiple columns in excel into 1 column with unique value Excel中两列之间的部分匹配,一列的返回值 - Partial match between two columns in excel, return value of one column Excel公式,如果一列中单元格的值保持不变,但另一列中的值发生变化,则显示给我 - Excel Formula if the value of a cell in one column stays the same but the value in another changes then show me
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM