如何将重复的行转换为列? [英] How to pivot duplicate rows to columns?
问题描述
很难弄清楚如何将具有重复行的多列数据集转换为唯一列.
我已经进行了研究,并发现了一些VBA脚本来执行此操作,但是当我进行计数以确认其正确旋转并最终一遍又一遍地添加重复的列(名称/评级年份)时,会导致数据丢失./p>
有人有什么想法吗?我会做一个数据透视表,但是我无法在数据透视表中显示实际评级值,只能显示总和/计数/平均值.等等...
您可以在powerquery中轻松地做到这一点.
- 突出显示所有数据,然后插入>添加表格
- 数据标签>从表格中获取数据
- 突出显示右两列>枢轴列
- 将等级定为值
- 高级选项>不要汇总
- 找到并将空值替换为空
- 保存并关闭
having a hard time figuring out how to pivot a multi-column data set with duplicate rows into unique columns.
I have done research and found some VBA scripts to do this, but it is resulting in data missing when I do counts to confirm it pivoted correctly and ends up adding in duplicate columns (name/ rating year) over and over.
Anyone have any ideas? I'd do a pivot table, but I can't display the actual rating values in a pivot, only a sum/count/avg. etc...
You can do this easily in powerquery.
- Highlight all your data, then insert>add table
- data tab>get data from table
- highlight right two columns>pivot columns
- rating level as values
- advanced options>don't aggregate
- find and replace null with nothing
- save and close
这篇关于如何将重复的行转换为列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!