如何更改 excel table 布局?
How can I change my excel table layout?
我目前遇到了 Excel 数据的问题。
我有一个包含以下值的 csv 文件;
**Country | Country Code | 1990 | 1991 | 1992 | ... | 2015**
*United States | US | 93 | 93.5 | 93.2 | ... | 95.4*
*The Netherlands | NL | 100 | 100 | 100 | ... | 100*
但是,我不想看到每个国家和每年的价值。我需要年份在同一列中。所以基本上是这样的;
**Country | Country Code | Years | Values**
*United States | US | 1990 | 93*
*United States | US | 1991 | 93.5*
*United States | US | 1992 | 93.2*
老实说,我想不出解决这个问题的方法。希望大家能帮帮我!
2016 年 Excel:
您应该首先使用 Excel 的 Data/From Table 功能将数据导入 Power Query。
数据在 Power Query 中后,应选择年份列,并且应选择 Transform/Unpivot Columns/Unpivot 仅选定列。
列被逆透视后,您可以使用 Home/Close&Load 按钮将此数据加载回 Excel。
我同意最简单的方法是使用 PowerQuery(又名 "Get and Transform" in Excel 2016 或更高版本)。 Google PowerQuery Unpivot,你会找到数百个教程,比如我的好朋友 Chandoo 的教程 https://chandoo.org/wp/2015/09/29/unpivot-data-with-power-query/
否则,这里有几个备选方案:
- 使用VBA。 Google 反转 VBA 并显示数百个结果,
包括我一段时间前发布的这段速度极快的代码:
http://dailydoseofexcel.com/archives/2013/11/21/unpivot-shootout/
(在“2013 年 11 月 26 日更新”标题下查找代码。)
- 使用 DoubleClick 提取技巧。看
http://datapigtechnologies.com/blog/index.php/transposing-a-dataset-with-a-pivottable/
我目前遇到了 Excel 数据的问题。 我有一个包含以下值的 csv 文件;
**Country | Country Code | 1990 | 1991 | 1992 | ... | 2015**
*United States | US | 93 | 93.5 | 93.2 | ... | 95.4*
*The Netherlands | NL | 100 | 100 | 100 | ... | 100*
但是,我不想看到每个国家和每年的价值。我需要年份在同一列中。所以基本上是这样的;
**Country | Country Code | Years | Values**
*United States | US | 1990 | 93*
*United States | US | 1991 | 93.5*
*United States | US | 1992 | 93.2*
老实说,我想不出解决这个问题的方法。希望大家能帮帮我!
2016 年 Excel:
您应该首先使用 Excel 的 Data/From Table 功能将数据导入 Power Query。
数据在 Power Query 中后,应选择年份列,并且应选择 Transform/Unpivot Columns/Unpivot 仅选定列。
列被逆透视后,您可以使用 Home/Close&Load 按钮将此数据加载回 Excel。
我同意最简单的方法是使用 PowerQuery(又名 "Get and Transform" in Excel 2016 或更高版本)。 Google PowerQuery Unpivot,你会找到数百个教程,比如我的好朋友 Chandoo 的教程 https://chandoo.org/wp/2015/09/29/unpivot-data-with-power-query/
否则,这里有几个备选方案:
- 使用VBA。 Google 反转 VBA 并显示数百个结果, 包括我一段时间前发布的这段速度极快的代码: http://dailydoseofexcel.com/archives/2013/11/21/unpivot-shootout/ (在“2013 年 11 月 26 日更新”标题下查找代码。)
- 使用 DoubleClick 提取技巧。看 http://datapigtechnologies.com/blog/index.php/transposing-a-dataset-with-a-pivottable/