简体   繁体   English

excel计算列的唯一组合

[英]excel count unique combinations of columns

I'm looking to build a formula that counts the number of specific combinations of columns. 我正在寻找一个公式来计算列的特定组合数。 An example of what I'm looking at for data is similar to this. 我正在寻找数据的示例与此类似。

Invoice   Account
A1415     1234
A1415     4567
B1415     1234
B1415     1234
B1415     4567
A1415     4567
C1415     1234

Out of this data I have 5 unique combinations from the columns. 在这些数据中,我从列中有5个唯一的组合。 Can anyone help build a countif equation that looks at both columns together? 任何人都可以帮助建立一个同时查看两列的countif方程吗? I'm stumped on this one. 我对此很困惑。 Thanks! 谢谢!

Array formula** , assuming data in A1:B7: 数组公式** ,假设数据在A1:B7中:

=SUM(IF(FREQUENCY(MATCH(A1:A7&"|"&B1:B7,A1:A7&"|"&B1:B7,0),ROW(A1:A7)-MIN(ROW(A1:A7))+1),1))

Regards 问候

**Array formulas are not entered in the same way as 'standard' formulas. **数组公式的输入方式与“标准”公式的输入方式不同。 Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. 首先按住CTRL和SHIFT,然后再按Enter,而不是仅按ENTER。 If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself). 如果操作正确,您会注意到Excel在公式周围使用大括号{}(尽管不要尝试自己手动插入大括号)。

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

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