Matching one row with another row of same column iteratively and getting sum at bottom of the column?

genetist

Board Regular
Joined
Mar 29, 2013
Messages
75
Office Version
  1. 2016
Platform
  1. Windows
Dear All
good morning

I have data like this
IND M1 M2 M3 M4 M5
1 A/A G/G C/C T/T T/T
2 T/T C/C C/C G/G G/G
3 C/C T/T C/C C/C C/C
4 G/G T/T T/T G/C A/A
5 G/G T/T G/G C/T A/A


Step1: First i would like to give zero if any M column (2nd Row) from M1 to M5 contains different letters like A/T,A/G,A/C,T/A,T/G,T/C,G/A,G/T,G/C,C/A,C/T,C/G
Step3: MATCHING SINGLE ROW WITH ALL THE ROWS AND LIKE THIS ALL THE ROWS WITH REMAINING ROWS for example Matching B3 with B4,B5,B6,B7 and then matching B4 with B3,B5,B6,B7 and I will do same thing with B5,6 and B7 if matches then 0 otherwise 1 and finally I want to sum all the non matches i.e.1's. Now i would like to repeat same rocedure to columns C,D,E,F
Step3: i would like to get sum of all the one's at bottom of each column from B to F


Here i am sharing example for better understanding of my issue.


https://www.dropbox.com/s/iq7m5a2e4e...0PIC.xlsx?dl=0


Here i tried normal if conditions and i can match one row with other and it is taking lot of time but i want to compare all at one time may be through macro or very good formula. I am requesting you all to help and any help in this regard is highly appreciable.
Thanks in advance
Genetist
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
The link to your file doesn't work, comes back as 404 We can’t find what you’re looking for.
 
Upvote 0
See if this formula, copied across, does what you want.

Excel Workbook
ABCDEF
1INDM1M2M3M4M5
21A/AG/GC/CT/TT/T
32T/TC/CC/CG/GG/G
43C/CT/TC/CC/CC/C
54G/GT/TT/TG/CA/A
65G/GT/TG/GC/TA/A
7
81814141218
Sheet3
 
Upvote 0
Dear Peter_SSs
sorry for my late reply. your formula worked perfectly on my data. Thanks lot for your help and time spent on this
Regards
 
Upvote 0
Good news. Thanks for letting us know - eventually. :)
 
Last edited:
Upvote 0
Dear
Dear Peter_SSs
is it possibile to ommit from calculation ((i mean no comparisons this cell with any other cells even if did outcome should be 0)) if any cell having text MISSING from B2 to F6
Thanking you very much in Advance
 
Upvote 0
I don't understand what you are asking.

What about some representative sample data and expected results with XL2BB and further explanation in relation to that sample data?

Also, please update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
I don't understand what you are asking.

What about some representative sample data and expected results with XL2BB and further explanation in relation to that sample data?

Also, please update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Dear Peter_Sss
please check my example data
SNP PIC.xlsx
ABCDEF
1INDM1M2M3M4M5
21A/AG/GMISSINGT/TT/T
32T/TC/CC/CG/GG/G
43C/CT/TC/CC/CC/C
54G/GT/TT/TG/CA/A
65G/GT/TG/GC/TA/A
7
8I wiss to get
9INDM1M2M3M4M5
101A/AG/GMISSINGT/TT/T
112T/TC/CC/CG/GG/G
123C/CT/TC/CC/CC/C
134G/GT/TT/TG/CA/A
145G/GT/TG/GC/TA/A
15181410618
16
17example calculation
18A/AA/A0
19A/AT/T1
20A/AC/C1
21A/AG/G1
22A/AG/G1
23T/TA/A1
24T/TT/T0
25T/TC/C1
26T/TG/G1
27T/TG/G1
28C/CA/A1
29C/CT/T1
30C/CC/C0
31C/CG/G1
32C/CG/G1
33G/GA/A1
34G/GT/T1
35G/GC/C1
36G/GG/G0
37G/GG/G0
38G/GA/A1
39G/GT/T1
40G/GC/C1
41G/GG/G0
42G/GG/G0
4318
Sheet2
Cell Formulas
RangeFormula
F15,B15:C15B15=SUMPRODUCT(ROWS(B10:B14)-COUNTIF(B10:B14,B10:B14))-(ROWS(B10:B14)-1)*SUMPRODUCT(--(LEFT(B10:B14,1)<>RIGHT(B10:B14,1)))

Thanks in advance
 
Last edited by a moderator:
Upvote 0
Sorry, I am still not following.
The example for the calculation that you have provided seems to be the same as column B from post #4 and the formula provided there still produces 18 for that column.
The previous formula also produces the expected results here for columns C and F.

What I think I need is the steps for columns D & E as those results appear to be different. As well as providing the list of 0/1 values, I need to know how you determine each of those 0/1 values.
 
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,396
Members
448,891
Latest member
tpierce

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top