lrobbo314
Well-known Member
- Joined
- Jul 14, 2008
- Messages
- 3,957
- Office Version
- 365
- Platform
- Windows
SPLITBYGROUP splits a range by the values in a given column.
The SPLITBYGROUP formula uses another formula, INSERTAT, which will be listed below as well.
I was inspired to write this because of a post from @jaeiow in this post.
SPLITBYGROUP
INSERTAT
The SPLITBYGROUP formula uses another formula, INSERTAT, which will be listed below as well.
I was inspired to write this because of a post from @jaeiow in this post.
SPLITBYGROUP
Excel Formula:
=LAMBDA(
range,col,
LET(
d,range,
r,ROWS(d),
q,SEQUENCE(r-1,,r,-1),
REDUCE(d,q,LAMBDA(s,c,IF(INDEX(s,c,col)<>INDEX(s,c-1,col),INSERTAT(s,c),s)))
)
)
INSERTAT
Excel Formula:
=LAMBDA(
range,current,
LET(
r,ROWS(range),
c,COLUMNS(range),
VSTACK(
INDEX(range,SEQUENCE(current-1),SEQUENCE(,c)),
VSTACK(
INDEX(" ",1,SEQUENCE(,c,1,0)),
INDEX(range,SEQUENCE(r-current+1,,current),SEQUENCE(,c))
)
)
)
)
SPLITBYGROUP | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | ID | SplitCol | Value | ID | SplitCol | Value | |||
2 | 1 | A | 93 | 1 | A | 93 | |||
3 | 2 | A | 4 | 2 | A | 4 | |||
4 | 3 | B | 9 | ||||||
5 | 4 | C | 97 | 3 | B | 9 | |||
6 | 5 | C | 89 | ||||||
7 | 6 | C | 77 | 4 | C | 97 | |||
8 | 7 | D | 89 | 5 | C | 89 | |||
9 | 6 | C | 77 | ||||||
10 | |||||||||
11 | 7 | D | 89 | ||||||
Sheet5 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2:G11 | E2 | =SPLITBYGROUP(A2:C8,2) |
Dynamic array formulas. |
Upvote
0