Trying to figure out a formula where I have lets say 5 columns of text data. I want to count how many times any 2 column data appears in a row.

For example:
A,A,A,B,C;

A,B,B,A,A

In this case I want to Count A,A showing up twice, A,B showing up twice, B,C showing up once etc.

Thanks