转置数据列表

huangapple go评论63阅读模式
英文:

Transpose data list

问题

我有一个表格,看起来像这样:

Item# Name Value Quantity
21 John $345 3
22 John $21 1
23 John $323 4
21 Bob $254 1
22 Bob $34 2
23 Bob $400 4
21 Suzy $254 9
22 Suzy $25 1
23 Suzy $202 15

我希望将其转换为如下形式:

Item John Bob Suzy
Item# Value Quantity value
---------- ------ -------- ------
21 $345 3 $254
22 $21 1 $34
23 $323 4 $400

如何使用VBA转置表格?

英文:

I have a table which looks like this:

Item# Name Value Quantity
21 John $345 3
22 John $21 1
23 John $323 4
21 Bob $254 1
22 Bob $34 2
23 Bob $400 4
21 Suzy $254 9
22 Suzy $25 1
23 Suzy $202 15

and I wish to convert into something like this:

Item John Bob Suzy
Item# Value Quantity value
---------- ------ -------- ------
21 $345 3 $254
22 $21 1 $34
23 $323 4 $400

How to transpose the table using VBA?

答案1

得分: 1

将光标放在数据表内的任何位置,转到“插入” > “数据透视表” > “来自表/区域” > “插入新工作表” 就可以实现你想要的效果。

右侧会打开“数据透视表字段”面板,这部分不太直观。尝试将项目拖到行,名称拖到列,值拖到值,这几乎会立刻复制你上面的示例。

这是一个功能强大的工具,具有许多秘密和隐藏的功能。你可能想在YouTube上搜索“excel数据透视表基础”或类似的内容。

英文:

I think a Pivot Table will get you exactly where you want to go. Place your cursor anywhere within your data table, go to Insert > PivotTable > From Table/Range > Insert New Sheet.
The "PivotTable Fields" panel that opens on the right is not super-intuitive. Try dragging Item onto Rows and name onto Columns, and Value onto Values. This will almost replicate your sample above, instantly.
This is an incredibly powerful tool with many secret and hidden capabilities. You might want to search youTube for "excel pivot table essentials" or similar.

huangapple
  • 本文由 发表于 2023年3月12日 10:48:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75710807.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定