使用宏格式化excel中的半结构化数据

时间:2014-03-14 13:09:11

标签: excel vba excel-vba

我一直试图找到一个vb宏或者类似的格式化一个100k行的数据库

我把它放在.txt文件中,所以我把它放在excel中并考虑解决方案。

例如,我考虑过从第一个[f_id]到下一个[f_id]取出每一行的可能性,然后使用excel本身来分隔每一行,例如"]"但我不太清楚该怎么做。

如果出于某种原因,所有内容都会混淆,也可以使用某种控件,例如[data c]

列中的[data b]

帮助将不胜感激:)提前致谢!

   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..

  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]

0 个答案:

没有答案