Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count pairings of cells in spreadsheet

Tags:

excel

Let's say I have a spreadsheet that has two columns of data. For example:

A    B
1    2
2    3
1    1
1    2
1    3
2    3
2    1 

How could I count the total number of times each pair appears in the spreadsheet. In the example above, 1-2 should have a count of 3 (1 for 2-1, 2 for 1-2), 2-3 should have a count of 2etc

like image 792
WildBill Avatar asked Jan 19 '23 00:01

WildBill


1 Answers

Note that for Excel versions >2007, you can use the new formula COUNTIFS:

[EDIT] Added the correct solution (credits to Chris Nielsen - see the comments)

=COUNTIFS($A$1:$A$12,A1,$B$1:$B$12,B1) + COUNTIFS($A$1:$A$12,B1,$B$1:$B$12,A1)
like image 170
JMax Avatar answered Jan 25 '23 17:01

JMax