Excel 多行表头的列转行

Excel中A3:F6是带表头的典型表格,但上面多了额外的两行表头:

|---|---------|---------|-------------|-------------|----------|----------|
| | A | B | C | D | E | F |
| 1 | | | Actuals | Actuals | Plan | Plan |
| 2 | | | FY20 | FY21 | FY20 | FY21 |
| 3 | Country | Owner | 1/1/2020 | 1/1/2020 | 1/1/2020 | 1/1/2020 |
| 4 | France | Richard | 100 | 150 | 80 | 160 |
| 5 | France | Martin | 120 | 140 | 130 | 140 |
| 6 | France | Pierre | 50 | 100 | 50 | 80 |

现在要将典型表格连同额外的两行表头同时进行列转行:

|----|-------------|-----------|-------------|----------|----------|-----------|
| | A | B | C | D | E | F |
| 9 | Country | Owner | Version | Year | Date | Value |
| 10 | France | Richard | Actuals | FY20 | 1/1/2020 | 100 |
| 11 | France | Richard | Actuals | FY21 | 1/1/2020 | 150 |
| 12 | France | Richard | Plan | FY20 | 1/1/2020 | 80 |
| 13 | France | Richard | Plan | FY21 | 1/1/2020 | 160 |
| 14 | France | Martin | Actuals | FY20 | 1/1/2020 | 120 |
| 15 | France | Martin | Actuals | FY21 | 1/1/2020 | 140 |
| 16 | France | Martin | Plan | FY20 | 1/1/2020 | 130 |
| 17 | France | Martin | Plan | FY21 | 1/1/2020 | 140 |
| 18 | France | Pierre | Actuals | FY20 | 1/1/2020 | 50 |
| 19 | France | Pierre | Actuals | FY21 | 1/1/2020 | 100 |
| 20 | France | Pierre | Plan | FY20 | 1/1/2020 | 50 |
| 21 | France | Pierre | Plan | FY21 | 1/1/2020 | 80 |

使用 SPL XLL,输入公式:

复制代码
=spl("=c=transpose(?2),?1.conj( (a=~).m(3:).(a.to(2)|c(#)|~))",A4:F6,C1:F3)

=spl("=c=transpose(?2),?1.conj( (a=~).m(3:).(a.to(2)|c(#)|~))",A4:F6,C1:F3)

transpose将表头 C1:F3 进行转置,conj 合并集合成员,~ 表示表格 A4:F6 每一行,m(3:) 表示从每行的第 3 个成员取到结尾。

相关推荐
jgyzl5 小时前
2026.3.20 用EasyExcel实现excel报表的导入与导出
java·python·excel
Mr.45671 天前
Spring Boot 3 + EasyExcel 3.x 实战:构建高效、可靠的Excel导入导出服务
spring boot·后端·excel
如意机反光镜裸1 天前
excel怎么快速导入oracle
数据库·oracle·excel
开开心心就好1 天前
免费轻量级PDF阅读器,打开速度快
windows·计算机视觉·visualstudio·pdf·计算机外设·excel·myeclipse
城数派2 天前
2015-2025年我国区县逐年二手房房价数据(Excel/Shp格式)
excel
用户8356290780512 天前
Python 设置 Excel 条件格式教程
后端·python·excel
lzksword2 天前
关于EXCEL中vlookup身份证匹配失败的处理
excel
城数派2 天前
1990-2025年我国省市县三级的逐年土地覆盖数据(9类用地/Excel/Shp格式)
excel
catoop2 天前
构建高稳健性、可交互的复杂 Excel 报表方法论:切片、流式与动态公式
excel