I have a single row of data in excel. Data is around 5000+ values.
I want to split this single row into multiple rows.Below is the example of same.
My Single row contains data as follows, 1 2 3 4 5 A 1 2 4 5 9 5 9 A 2 1 4 A etc...
I want this single row to be split after every "A" value it reaches. Output below.
1 2 3 4 5
A 1 2 4 5 9 5 9
A 2 1 4
A Etc...
Can some1 help me as how this can be done? Macro is fine with me. Also I have huge data like 5000+ Values.
This should do your job. Considering your data to be in Sheet1 and output is generated in Worksheet Sheet2.
Try using
Text to Columns
and useA
as your delimiter. You'll have to add theA
back into the resulting cells.if your data is like this:
then put
=TRANSPOSE(A1:D1)
in A2, and confirm withCtrl
+shift
+enter
, which will result in formula that looks like:{=TRANSPOSE(A1:D1)}
and a result that looks like:
or you you are after a one-off operation you can always: select -> copy ; select empty cell -> paste special -> tick transpose
If your data is in a single cell, say, cell
A1
, then you can use vba's split to store all of the individual pieces in an array, split with the letterA
.In your example,
myArray(0) = 1 2 3 4 5
,myArray(1) = 1 2 4 9 5
, etc.So if each of those elements needs to be in its own row, you can concatenate the
A
back onto the front, like soand so forth.