Xlambda
Well-known Member
- Joined
- Mar 8, 2021
- Messages
- 860
- Office Version
- 365
- Platform
- Windows
AINSERT !! recursive !! array insert, insert any string delimiter "d" between characters of an array "a" with a selectable pace "p" and selectable starting point "i".
Excel Formula:
=LAMBDA(a,d,p,i,
LET(ld,LEN(d),k,MAX(p,1),j,MAX(k+1,i),n,MAX(LEN(a)),
IF(n<(j-1),SUBSTITUTE(TRIM(SUBSTITUTE(a,d," "))," ",d),AINSERT(REPLACE(a,j,,d),d,k,j+2*(k+1)-k-1+ld-1))
)
)
LAMBDA 6.0.xlsx | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | |||
1 | sample | =AINSERT(A2:A4,"-",1,) | ||||||||||||||||||
2 | qwertyuiop98765 | q-w-e-r-t-y-u-i-o-p-9-8-7-6-5 | ||||||||||||||||||
3 | asdfghjkl123 | a-s-d-f-g-h-j-k-l-1-2-3 | ||||||||||||||||||
4 | zxcvbnm123456 | z-x-c-v-b-n-m-1-2-3-4-5-6 | ||||||||||||||||||
5 | ||||||||||||||||||||
6 | =AINSERT(A2:A4,"--",,) | |||||||||||||||||||
7 | q--w--e--r--t--y--u--i--o--p--9--8--7--6--5 | |||||||||||||||||||
8 | a--s--d--f--g--h--j--k--l--1--2--3 | |||||||||||||||||||
9 | z--x--c--v--b--n--m--1--2--3--4--5--6 | |||||||||||||||||||
10 | extract values with | ASPLIT | extract only text values with | AFILTER | ||||||||||||||||
11 | =AINSERT(A2:A4,"-",2,) | =ASPLIT(C12:C14,"-") | =AFILTER(D12#,-1,) | |||||||||||||||||
12 | qw-er-ty-ui-op-98-76-5 | qw | er | ty | ui | op | 98 | 76 | 5 | qw | er | ty | ui | op | ||||||
13 | as-df-gh-jk-l1-23 | as | df | gh | jk | l1 | 23 | as | df | gh | jk | l1 | ||||||||
14 | zx-cv-bn-m1-23-45-6 | zx | cv | bn | m1 | 23 | 45 | 6 | zx | cv | bn | m1 | ||||||||
15 | ||||||||||||||||||||
16 | =AINSERT(A2:A4,"--",3,) | =ASPLIT(C17#,"--") | extract only numeric values | |||||||||||||||||
17 | qwe--rty--uio--p98--765 | qwe | rty | uio | p98 | 765 | =AFILTER(D12#,1,) | |||||||||||||
18 | asd--fgh--jkl--123 | asd | fgh | jkl | 123 | 98 | 76 | 5 | ||||||||||||
19 | zxc--vbn--m12--345--6 | zxc | vbn | m12 | 345 | 6 | 23 | |||||||||||||
20 | 23 | 45 | 6 | |||||||||||||||||
21 | i=5,inserting starts after 4th character | |||||||||||||||||||
22 | =AINSERT(A2:A4,"///",3,5) | =ASPLIT(C23#,"///") | ||||||||||||||||||
23 | qwer///tyu///iop///987///65 | qwer | tyu | iop | 987 | 65 | ||||||||||||||
24 | asdf///ghj///kl1///23 | asdf | ghj | kl1 | 23 | |||||||||||||||
25 | zxcv///bnm///123///456 | zxcv | bnm | 123 | 456 | |||||||||||||||
26 | ||||||||||||||||||||
AINSERT post |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C1,C22:D22,M17,C16:D16,M11,C11:D11,C6 | C1 | =FORMULATEXT(C2) |
C2:C4 | C2 | =AINSERT(A2:A4,"-",1,) |
C7:C9 | C7 | =AINSERT(A2:A4,"--",,) |
C12:C14 | C12 | =AINSERT(A2:A4,"-",2,) |
D12:K14 | D12 | =ASPLIT(C12:C14,"-") |
M12:Q14 | M12 | =AFILTER(D12#,-1,) |
C17:C19 | C17 | =AINSERT(A2:A4,"--",3,) |
D17:H19 | D17 | =ASPLIT(C17#,"--") |
M18:O20 | M18 | =AFILTER(D12#,1,) |
C23:C25 | C23 | =AINSERT(A2:A4,"///",3,5) |
D23:H25 | D23 | =ASPLIT(C23#,"///") |
Dynamic array formulas. |
Last edited by a moderator:
Upvote
0