Xlambda
Well-known Member
- Joined
- Mar 8, 2021
- Messages
- 860
- Office Version
- 365
- Platform
- Windows
ATRIM array trim, does for any delimiter what TRIM does to space chars, plus can CLEAN any non printable chars, replaces non breaking spaces CHAR(160), with regular spaces.
Excel Formula:
=LAMBDA(a,d,c,
LET(x,OR(c={0,1}),h,CHAR(1),
ax,IF(c,SUBSTITUTE(CLEAN(a),CHAR(160)," "),a),
ay,IF(OR(d=0,d=""),ax,SUBSTITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(TRIM(ax)," ",CHAR(1)),d," "))," ",d),CHAR(1)," ")),
IF(x,ay,"check values")
)
)
LAMBDA 6.0.xlsx | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | |||
1 | ||||||||||||||||||||
2 | CLEAN works | ok | CLEAN works | no CLEAN | ||||||||||||||||
3 | line feed | c return | space | non breaking space | ||||||||||||||||
4 | sample CODE values | 2 | 9 | 10 | 13 | 28 | 29 | 30 | 31 | 32 | 129 | 141 | 143 | 144 | 157 | 160 | ||||
5 | ="ab"&CHAR(B4:P4)&"cd" | abcd | ab cd | ab cd | ab cd | abcd | abcd | abcd | abcd | ab cd | abcd | abcd | abcd | abcd | abcd | ab cd | ||||
6 | =LEN(B5#) | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | ||||
7 | ||||||||||||||||||||
8 | =ATRIM(B5#,,1) | abcd | abcd | abcd | abcd | abcd | abcd | abcd | abcd | ab cd | abcd | abcd | abcd | abcd | abcd | ab cd | ||||
9 | =LEN(B8#) | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 5 | 4 | 4 | 4 | 4 | 4 | 5 | ||||
10 | ||||||||||||||||||||
11 | sample | =ATRIM(I12:J14,"-",) | sample | =ATRIM(N12:N14,"//",) | ||||||||||||||||
12 | ="--sd"&CHAR(1)&"fr--"&CHAR(129)&"--4"&CHAR(160)&"5--fvb#45--" | --r 67--t-- | ---pb 18-h | r 67-t | pb 18-h | //iut yt56//rtujh45////sdfg$%456 | iut yt56//rtujh45//sdfg$%456 | |||||||||||||
13 | --sdfr----4 5--fvb#45-- | s 56---v- | xy 78-n | s 56-v | xy 78-n | rtyu//ghj //46ghh// yuyt //ghfd65 | rtyu//ghj //46ghh// yuyt //ghfd65 | |||||||||||||
14 | -t 89-w | gh 98--y-- | t 89-w | gh 98-y | //34%&/dfg/////jhgf////dfg345 | 34%&/dfg///jhgf//dfg345 | ||||||||||||||
15 | =ATRIM(B13,"-",1) | |||||||||||||||||||
16 | sdfr-4 5-fvb#45 | |||||||||||||||||||
17 | ||||||||||||||||||||
ATRIM post |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A5:A6,A8:A9 | A5 | =FORMULATEXT(B5) |
B5:P5 | B5 | ="ab"&CHAR(B4:P4)&"cd" |
B6:P6,B9:P9 | B6 | =LEN(B5#) |
B8:P8 | B8 | =ATRIM(B5#,,1) |
K11,B15,Q11,B12 | K11 | =FORMULATEXT(K12) |
K12:L14 | K12 | =ATRIM(I12:J14,"-",) |
Q12:Q14 | Q12 | =ATRIM(N12:N14,"//",) |
B13 | B13 | ="--sd"&CHAR(1)&"fr--"&CHAR(129)&"--4"&CHAR(160)&"5--fvb#45--" |
B16 | B16 | =ATRIM(B13,"-",1) |
Dynamic array formulas. |
Upvote
0