Need help from Macro Gurus

  • Thread starter Vijay.Nandakumar
  • Start date
V

Vijay.Nandakumar

Hello All,
I am faced with a problem to merge columns. I need a Macro that will
do the following operation. This is how my raw file looks.

Sample # CD1 CD2 Sample # CD3 Sample # Cd8a2 Sample # Cd8b7
B1234567 400 100 B1234567 6.1 B1234568 5.1
B1235678 2.5
B1235678 500 200 0 0 0
0 B1234568 3.5
B1234568 600 300 0 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0



My desired out put format is

Sample # CD1 CD2 CD3 Cd8a2 Cd8b7
B1234567 400 100 6.1 0 0
B1235678 500 200 0 0 2.5
B1234568 600 300 0 5.1 3.5
0 0 0 0 0
0
0 0 0 0 0
0


This pattern actually extends to about 35 columns and 50 rows but if
you guys can guide me with the basic logic, I might be able to extend
it for my case.
Thanks,
Vij
 
V

Vijay.Nandakumar

Sample # CD1 CD2 Sample # CD3 Sample # Cd8a2 Sample # Cd8b7
B1234567 400 100 B1234567 6.1 B1234568 5.1 B1235678 2.5
B1235678 500 200 0 0 0 0 B1234568 3.5
B1234568 600 300 0 0 0 0 0 0
0 0 0 0
0 0 0 0 0
 
B

Bob Greenblatt

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

Sorry for the confusion....
here is what I am trying to do
I have my data in the following format

Sample# Col1 Col2 Sample # Col3 Sample # Col4 Sample# .......
A1 1 4 A2 1 A2
4
A2 2 5 0 0 A3 3
A3 3 6 0 0 0 0
0 0 0 0 0 0 0

and the results should be

Sample# Col1 Col2 Col3 Col4
A1 1 4 0 0
A2 2 5 1 4
A3 3 6 0 3


Hopefully, I am a little clear now. Thank you for responding.
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

Sorry for the confusion....
here is what I am trying to do
I have my data in the following format

Sample# Col1 Col2 Sample # Col3 Sample # Col4 Sample# .......
A1 1 4 A2 1 A2 4
A2 2 5 0 0 A3 3
A3 3 6 0 0 0 0
0 0 0 0 0 0 0

and the results should be

Sample# Col1 Col2 Col3 Col4
A1 1 4 0 0
A2 2 5 1 4
A3 3 6 0 3


Hopefully, I am a little clear now. Thank you for responding.
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?
Hopefully, this makes sense...Thank you


Sample # Col1 Col2 Sample # Col3 Sample # Col4
A1 1 4 A1 6.1 A2 1.6
A2 2 5 0 0 A3 2.5
A3 3 6 0 0 0 0
0 0 0 0 0 0 0



Sample # Col1 Col2 Col3 Col4
A1 1 4 6.1 0
A2 2 5 0 1.6
A3 3 6 0 2.5
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

Sample # Col1 Col2 Sample # Col3 Sample # Col4

A1 1 4 A1 6.1 A2 1.6
A2 2 5 0 0 A3 2.5
A3 3 6 0 0 0 0
0 0 0 0 0 0 0



Sample # Col1 Col2 Col3 Col4
A1 1 4 6.1 0
A2 2 5 0 1.6
A3 3 6 0 2.5
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

This is what I am trying to accomplish. Thanks for taking the time
Sample # Col1 Col2 Sample # Col3 Sample # Col4
A1 1 4 A1 6.1 A2 1.6
A2 2 5 0 0 A3 2.5
A3 3 6 0 0 0 0
0 0 0 0 0 0 0



Sample # Col1 Col2 Col3 Col4
A1 1 4 6.1 0
A2 2 5 0 1.6
A3 3 6 0 2.5
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

Sample # Col1 Col2 Sample # Col3 Sample # Col4
A1 1 4 A1 6.1 A2 1.6
A2 2 5 0 0 A3 2.5
A3 3 6 0 0 0 0
0 0 0 0 0 0 0



Sample # Col1 Col2 Col3 Col4
A1 1 4 6.1 0
A2 2 5 0 1.6
A3 3 6 0 2.5
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

Sample # Col1 Col2 Sample # Col3 Sample # Col4
A1 1 4 A1 6.1 A2 1.6
A2 2 5 0 0 A3 2.5
A3 3 6 0 0 0 0
0 0 0 0 0 0 0



Sample # Col1 Col2 Col3 Col4
A1 1 4 6.1 0
A2 2 5 0 1.6
A3 3 6 0 2.5
 
V

Vijay.Nandakumar

I don't have a clue as to what the problem is or what you are trying to do.
The text is wrapped so that it is impossible to decipher. Can you explain it
a little better, and supply another example that doesn't wrap?

Thanks for your time bob. I have tried to retabulate what I want to
achieve
Sample # Col1 Col2 Sample # Col3 Sample # Col4
A1 1 4 A1 6.1 A2 1.6
A2 2 5 0 0 A3 2.5
A3 3 6 0 0 0 0
0 0 0 0 0 0 0



Sample # Col1 Col2 Col3 Col4
A1 1 4 6.1 0
A2 2 5 0 1.6
A3 3 6 0 2.5


As you can see it is still not perfect but I guess this will give you
a better idea. In the raw data, the numbers 1,2,3, 0 fall under column
1 and so on...
and the desired data form is a bit clear (I hope).
Thanks again and waiting for your inputs
 
B

Bob Greenblatt

It still is not clear to me. Your six postings don't help much. Have you
tried text to columns from the data menu? Dos that help at all?
 
V

Vijay.Nandakumar

It still is not clear to me. Your six postings don't help much. Have you
tried text to columns from the data menu? Dos that help at all?


No the text to columns does not help....
What I am trying to do is Merge the Columns (the multiple Sample#
cloumns) to a single column of Sample# and rearrange the rows of
Col1, Col2, Col3.... according to the Value in the Sample# Column.
 
B

Bob Greenblatt

No the text to columns does not help....
What I am trying to do is Merge the Columns (the multiple Sample#
cloumns) to a single column of Sample# and rearrange the rows of
Col1, Col2, Col3.... according to the Value in the Sample# Column.
Well, I hate to pass this on, but I am leaving today for 2 weeks vacation. I
hope someone else will jump in and take over. Because of the poor text
wrapping you should offer to email a sample (don't attach one to the news
posting). Then it will be much clearer.
 
Top