hi to all VBA programmers,
I have data like this with 6 columns</SPAN>
[TABLE="width: 384"]
<TBODY>[TR]
[TD]LINES</SPAN></SPAN>
[/TD]
[TD]AB1</SPAN></SPAN>
[/TD]
[TD]AB2</SPAN></SPAN>
[/TD]
[TD]AB3</SPAN></SPAN>
[/TD]
[TD]AB4</SPAN></SPAN>
[/TD]
[TD]AB5</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P1</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]-/-</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P2</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]1</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]2</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]3</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]4</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]5</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P1</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]-/-</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P2</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]1</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]2</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]3</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]4</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]5</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
[TABLE="width: 512"]
<TBODY>[TR]
[TD]LINES</SPAN></SPAN>
[/TD]
[TD]XY1</SPAN></SPAN>
[/TD]
[TD]XY2</SPAN></SPAN>
[/TD]
[TD]XY3</SPAN></SPAN>
[/TD]
[TD]XY4</SPAN></SPAN>
[/TD]
[TD]XY5</SPAN></SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P1</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]NE</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]SUM</SPAN></SPAN>
[/TD]
[TD]%</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P2</SPAN></SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]2</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]100</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]3</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]4</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]5</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]100</SPAN></SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
Like this I have data in more than 5000 rows and at present I am doing in excel 2010 with different formulas but it is taking lot of my energy. If anyone provide VBA code for this task I will be more happy and it would be appreciated.
</SPAN>
Regards,</SPAN>
Genetist.</SPAN>
I have data like this with 6 columns</SPAN>
[TABLE="width: 384"]
<TBODY>[TR]
[TD]LINES</SPAN></SPAN>
[/TD]
[TD]AB1</SPAN></SPAN>
[/TD]
[TD]AB2</SPAN></SPAN>
[/TD]
[TD]AB3</SPAN></SPAN>
[/TD]
[TD]AB4</SPAN></SPAN>
[/TD]
[TD]AB5</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P1</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]-/-</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P2</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]1</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]2</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]3</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]4</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]5</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P1</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]-/-</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P2</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]Z/Z</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]1</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]2</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]3</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]G/G</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]4</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]C/C</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]5</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]T/T</SPAN></SPAN>
[/TD]
[TD]A/A</SPAN></SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
- First I want to find how many columns (from AB1 to AB5) are different for P1 and P2 , </SPAN>
- I will compare lines column values from 1 with P2 across all the columns (from AB1 to AB5) in horizontal way and continue for remaining lines from 2 to 5. if they match I would like to give 1 else 0 and I would like to continue this till my programme encounters second set of P1 and P2. Presently I am doing this with this formula =if(D4=D$3,1,0).</SPAN>
- I will make sum for lines 1 to 5 across all the columns from columns AB1 to AB5, but I will include only columns showing different for P1 and P2 in my sum count. Now I am working on this with sumif formula.</SPAN>
- I will calculate percentage of matching lines 1 to 5 with P2 by dividing sum came from SUMIF with number of different markers between P1 and P2.</SPAN>
- I want to repeat this for remaining set of P1 and P2.</SPAN>
[TABLE="width: 512"]
<TBODY>[TR]
[TD]LINES</SPAN></SPAN>
[/TD]
[TD]XY1</SPAN></SPAN>
[/TD]
[TD]XY2</SPAN></SPAN>
[/TD]
[TD]XY3</SPAN></SPAN>
[/TD]
[TD]XY4</SPAN></SPAN>
[/TD]
[TD]XY5</SPAN></SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P1</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]NE</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]EQ</SPAN></SPAN>
[/TD]
[TD]SUM</SPAN></SPAN>
[/TD]
[TD]%</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]P2</SPAN></SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]2</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]100</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]3</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]4</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[/TR]
[TR]
[TD]5</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]0</SPAN></SPAN>
[/TD]
[TD]1</SPAN></SPAN>
[/TD]
[TD]100</SPAN></SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
Like this I have data in more than 5000 rows and at present I am doing in excel 2010 with different formulas but it is taking lot of my energy. If anyone provide VBA code for this task I will be more happy and it would be appreciated.
</SPAN>
Regards,</SPAN>
Genetist.</SPAN>