Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49956

Formating semi-structured data in excel with macros

$
0
0
I've been trying to find a vb macro or similar to format a data base of 100k rows

I have it in a .txt file so I've put it in excel and thought about a solution.

For example I thought about the possibility of taking out every row from the first [f_id] till the following [f_id] and then use excel itself to separate every row having for example "]" but I'm not quite sure how to do it.

Also it would be nice to have some kind of control just in case for some reason everything gets mixed up, for example [data b] in the column of [data c]

Help would be appreciated :) Thanks in advance!

Before

Code:

  Col A
1
2 [f_id] => 1
3 [data a] => bla bla bla bla
4 [data b] => bla bla bla bla
5 [data c] => bla bla bla bla
6                                      //here for example a extra row, but it can be between [data a] and [data b]
7 [data d] => bla bla bla bla
8 continue in another row bla bla bla
9
10 [f_id] => 2
11 [data a] => bla bla bla bla
12 [data b] => bla bla bla bla
13                                      //here a random extra row
14 [data c] => bla bla bla bla
15                                      //here another random extra row
16 [data d] => bla bla bla bla          //here sometimes you can find the content in different rows, the only clear thing is that is always between [data d] and the following [data something] or [f_id]
17 continue in another row bla bla bla 
18 even more rows for data d
19
20 [f_id] => 3
21 ...
22 ...
23 ...
24 etc..

After

Code:

  Col A  Col B            Col C            Col D            Col E
1 [f_id]  [data a]        [data b]        [data c]        [data c]
2    1    bla bla bla bla  bla bla bla bla  bla bla bla bla  bla bla bla bla continue in another row bla bla bla
3    2    bla bla bla bla  bla bla bla bla  bla bla bla bla  bla bla bla bla continue in another row bla bla bla even more rows for [data d]


Viewing all articles
Browse latest Browse all 49956

Trending Articles