将格内多行文字展开成多格

表格的A列是分类,B列由多行文字组成,即分隔符是换行符。

|---|----------------|-------------------------------------------------------------------------------------------------------------------------|
| | A | B |
| 1 | Account Number | Interaction |
| 2 | 1 | Jan 1,2023 - Hello. |
| 3 | 2 | Jan 2, 2023 - Good morning. Jan 3, 2023 - Good night. Jan 4, 20 Jan 5, 2023 - Good night. Jan 6, 2023 - Good afternoon. |
| 4 | 3 | Jan 1,2023 - Good night. Jan 2, 2023 - Good afternoon. |

请将B列的每格展开成多个单元格,并复制A列

|---|----------------|-------------------------------|
| | A | B |
| 1 | Account Number | Interaction |
| 2 | 1 | Jan 1,2023 - Hello. |
| 3 | 2 | Jan 2, 2023 - Good morning. |
| 4 | 2 | Jan 3, 2023 - Good night. |
| 5 | 2 | Jan 4, 20 |
| 6 | 2 | Jan 5, 2023 - Good night. |
| 7 | 2 | Jan 6, 2023 - Good afternoon. |
| 8 | 3 | Jan 1,2023 - Good night. |
| 9 | 3 | Jan 2, 2023 - Good afternoon. |

使用 SPL XLL

复制代码
=spl("=?.news@q(~2.import@si();[get(1)(1),~])",A2:B4)

函数 news@q 用序列的成员生成新序列,~2 是当前变量的第 2 个成员,import@si将字符串按回车解析成单行字符串组成的序列,get 在多层循环中按层数返回循环变量。

相关推荐
小白学大数据15 小时前
超简单:用 Python 让 Excel 飞起来:用 openpyxl 把重复报表整理交给脚本
开发语言·数据库·python·excel
SunnyDays10111 天前
如何使用 Python 添加和编辑 Excel VBA 宏(无需安装 Excel)
开发语言·python·excel·vba
GHL2842710901 天前
codex操作excel学习
学习·ai·word·excel
一晌小贪欢3 天前
python-第15天:Python 列表推导式
开发语言·python·excel·数据可视化·python办公
tryxr3 天前
Chat2Excel 项目通用服务开发
java·开发语言·excel·java项目开发
Jazz_z3 天前
使用 Python 合并与取消合并 Excel 单元格
开发语言·python·excel
2601_962381865 天前
Python办公联动:Excel数据一键自动生成PPT图表
python·数据分析·自动化·excel·ppt
tryCbest6 天前
Excel常用公式(WPS vs Office)
excel·wps
taller_20006 天前
【006】何时用 Python?何时用 Excel 公式?一文讲清
python·excel·公式·pie·py
2601_949950636 天前
Word、PDF、Excel题目怎么快速整理?
pdf·word·excel