Counting Match Pairs In Rows

  • Thread starter Thread starter bmb2200
  • Start date Start date
B

bmb2200

I am trying to count the number of matched pairs by rows of data an
place this into a chart. Please see the screen shot example and manua
solution.

With the data sets:
1-2-3-4
1-3-4-5
2-3-4-6
3-4-5-6

I want to fill out the chart to find the number of times say 1&2 occu
in the same set and 1&3, 1&4, 2&3, 2&4, etc. The formula would b
filled into the result matrix.

Thanks for your help

+-------------------------------------------------------------------
|Filename: pairs.jpg
|Download: http://www.excelforum.com/attachment.php?postid=3725
+-------------------------------------------------------------------
 
One way which delivers what you're after ..
(with result matrix extended to cover: 0,1,2,3 ... 9 on both axes)

Link to sample file:
http://www.savefile.com/files/6483947
File: Counting Match Pairs In Rows_bmb2000_wksht.xls

In Sheet1:

Data is in cols B to E, from row3 down

Put in S3:X3

S3: =B3&C3
T3: =B3&D3
U3: =B3&E3
V3: =C3&D3
W3: =C3&E3
X3: =D3&E3

Select S3:X3, copy down as many rows as there are sets of numbers

Put in Z1: '00 (include the leading apostrophe)
Put in AA1: =COUNTIF($S$3:$X$6,Z1)
Select Z1:AA1, copy down to AA100

In the matrix, we have the 2 axes
In H2:Q2 are the numbers: 0,1,2,... 9
In G3:G12 are the numbers: 0,1,2,... 9

Put in H3: =INDEX($AA:$AA,MATCH(H$2&$G3,$Z:$Z,0))
Copy across to Q3, fill down to Q12 to populate the grid

Now to colour the internals of the matrix using conditional formatting

Select H3:Q12
Click Format > Conditional Formatting
Under condition 1, make it as:
Formula is: =ROWS($A$1:A1)<=COLUMNS($A$1:A1)
Format > Patterns tab > Black > OK
Click OK at the main dialog
 
Thanks so much for your solution. I countinued to try and solve m
issue and came up with another method. Both seem to have their pro
and cons.

In my solution, I made another matrix that counts which numbers come u
in each data set. Then I did a sumproduct for each pair. See th
attached zip spreadsheet.

Thanks again

+-------------------------------------------------------------------
|Filename: matching pairs.zip
|Download: http://www.excelforum.com/attachment.php?postid=3732
+-------------------------------------------------------------------
 
You're welcome ! Glad to hear that you found a solution to your problem,
and thanks for sharing it with us. Good luck with the game <g> !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top