练习一下,先上一个
- =LET(
- pick, LAMBDA(tnum, lnum, name,
- LET(
- adata, A:B,
- looparr, SEQUENCE(tnum - lnum + 1, 1, lnum),
- DROP(
- REDUCE(
- "",
- looparr,
- LAMBDA(acc, a, VSTACK(acc, HSTACK(name, INDEX(adata, a, 1), INDEX(adata, a, 2))))
- ),
- 1
- )
- )
- ),
- query, D1:E3,
- table, DROP(
- REDUCE(
- "",
- SEQUENCE(ROWS(query)),
- LAMBDA(acc, a, VSTACK(acc, HSTACK(TEXTSPLIT(INDEX(query, a, 2), "-"))))
- ),
- 1
- ),
- maketable, HSTACK(CHOOSECOLS(query, 1), SCAN(0, table, LAMBDA(acc, a, IF(a > acc, a, acc + 1)))),
- res, REDUCE(
- {"姓名", "号码", "套餐"},
- SEQUENCE(ROWS(maketable)),
- LAMBDA(acc, a,
- VSTACK(acc, pick(INDEX(maketable, a, 3), INDEX(maketable, a, 2), INDEX(maketable, a, 1)))
- )
- ),
- res
- )
复制代码
|