从一个电子表格中提取数据并将其插入模板中?

时间:2015-07-21 13:07:16

标签: string excel if-statement excel-formula vlookup

我正在寻找一种方法来获取一个包含数据的电子表格,并将其移动到另一个设置为虚假机架图的电子表格中。

例如,我想将数据格式化为:

+------+---+-------------+-------+---------+-------+
| Rack | U | Service Tag | Model | Project | Owner |
+------+---+-------------+-------+---------+-------+

并插入一个新的电子表格,其中" Rack"是一个预先存在的列标题," U"是第一列中的值,其他四个单元格合并为一个单元格。所以:

+-----+----+---------+--------+---------+----------+
| 566 | 36 | 1234567 | Server | Project | John Doe |
+-----+----+---------+--------+---------+----------+

将转换为:

+-----+-----+-----+-----+-----+----------+-----+-----+-----+
|  U  | 001 | 002 | ... | 555 |    566   | 567 | ... |  n  |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 042 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 041 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| ... |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 037 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 036 |     |     |     |     | John Doe |     |     |     |
|     |     |     |     |     | Server   |     |     |     |
|     |     |     |     |     | Project  |     |     |     |
|     |     |     |     |     | 1234567  |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 035 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| ... |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 002 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+
| 001 |     |     |     |     |          |     |     |     |
+-----+-----+-----+-----+-----+----------+-----+-----+-----+

已经定义了第一行和第一行。

有没有办法实现自动化,或者我只是手动操作?

如果没有超过900个需要移植的条目,我会手动完成。

1 个答案:

答案 0 :(得分:1)

"简单"在简单vlookup()公式中对我来说似乎有点低调。假设您的矩阵位于A1中的U不同的工作表中,那么在B2中复制横向和向下以适应:

=IFERROR(VLOOKUP(B$1&"|"&$A2,Sheet1!$H:$I,2,0),"")  
如果你的数据表(比如Sheet1和Rack的ColumnA)在H1中包含,那么

包装应该有效:

=A1&"|"&TEXT(B1,"000")  

和I1:

=F1&CHAR(10)&D1&CHAR(10)&E1&CHAR(10)&C1  

同时复制到适合。