# Counting occurences

#### Pepestru

##### New Member
Hi Excel Professors,
I have tried for some time to use excel functions for the following simple problem:
I have a spreadsheet with two columns (a few thousand rows) having the numbers 1 to 20.
I needs a matrix ( 1- 20 horizontal and 1-20 vertical) showing the number of occurrences of each combination found in the rows.
So I want to know how many times the combination 1-2 occurs, and so forth for all combinations with of 1-20 to 20-20.
Is this possible using standard functions of Excel?
Paul

### Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the \$ sign).
Hi Excel Professors,
I have tried for some time to use excel functions for the following simple problem:
I have a spreadsheet with two columns (a few thousand rows) having the numbers 1 to 20.
I needs a matrix ( 1- 20 horizontal and 1-20 vertical) showing the number of occurrences of each combination found in the rows.
So I want to know how many times the combination 1-2 occurs, and so forth for all combinations with of 1-20 to 20-20.
Is this possible using standard functions of Excel?
Paul
Book1
ABCDEFGHIJ
1XY12345
235101120
325200121
433300211
551400000
653511302
734
813
923
1014Count of XY
1153X12345
12121112
13242121
14523211
153351132
1614
1755
1853
1955
2024
Sheet1

E2, copied across then down:

=SUMPRODUCT(--(\$A\$2:\$A\$20=\$D2),--(\$B\$2:\$B\$20=E\$1))

The same results can be achieved with a pivot table as shown in D10:I15 in the exhibit.

Many thanks. It does exactly what I need!
Although I never would think about using this function, now I still do not understand why this does the job.........
Never mind, and thanks again,
Paul

My solution was not as elegant!

Sweet!

Replies
4
Views
157
Replies
2
Views
697
Replies
2
Views
1K
Replies
7
Views
243
Replies
3
Views
180

1,217,755
Messages
6,138,422
Members
450,136
Latest member
Tabako1960

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back