excel count unique combinations of columns

2019-08-15 20:11发布

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. Can anyone help build a countif equation that looks at both columns together? I'm stumped on this one. Thanks!

1条回答
Animai°情兽
2楼-- · 2019-08-15 20:18

Array formula**, assuming data in 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. 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).

查看更多
登录 后发表回答