Excel 基于列的切片器 headers

Excel Slicers based on Column headers

我正在尝试根据以下 table

制作枢轴 table 切片器

enter image description here

它有大约 3000 行。当我创建一个枢轴 table 然后使用切片器时。切片器像这样出现 enter image description here

虽然我想变成这样enter image description here

你有什么办法可以帮助我实现这一目标吗?

带或不带代码,但我更喜欢不带代码。

谢谢

数据透视表不喜欢交叉表(即列 headers 运行 横跨顶部)。您需要先 "unpivot" 您的数据,这意味着将其从交叉表更改为所谓的平面文件。

如果您已安装 PowerQuery add-in(或订阅了 Excel 2016 或 Excel/Office 365),则可以使用 PowerQuery 来执行此操作。 Google "PowerQuery" 和 "Unpivot" 你会找到一大堆视频。

否则,您可以使用 VBA,例如我之前在 http://dailydoseofexcel.com/archives/2013/11/21/unpivot-shootout/

上发布的 Unpivot 例程