I have 300+ rows containing 40+ columns, each column has a number 1-40 at random.

I want to know how to search each row for pairs or numbers that occur together within the row.

Example.

```
5 10 12 14 16 17 19 30 31 32 33 40 51
4 7 11 16 17 23 24 26 32 37 39 46 47
1 2 4 7 11 15 18 31 34 35 37 38 43
3 6 14 16 19 21 24 27 33 34 38 42 47
5 7 8 15 17 22 23 24 26 27 30 37 40
```

I want to know how many time 1 and 2 occur together or 23 and 24, or 5 and 30.

How would I do this? which formula would I use and how would I implement it.

I've looked at countifs, pivot tables, sumproducts, totals. And I am more confused than when I started.