T_CHARS

=T_CHARS(d,l,e)

d
digits, 0 or ignored, no digits, 1 all digits
l
letters, 0 or ignored, no letters, -1, small letters, 1, capital letters, 2, all letters
e
string, extra chars

tool lambda to select chars useful in recursive text manipulation formulas

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
860
Office Version
  1. 365
Platform
  1. Windows
T_CHARS tool lambda to select chars useful in recursive text manipulation formulas
Excel Formula:
=LAMBDA(d,l,e,
    LET(c,AND(OR(d={0,1}),OR(l={-1,0,1,2})),
       u,CONCAT(SEQUENCE(10)-1),v,CONCAT(CHAR(SEQUENCE(26,,97))),w,UPPER(v),
       x,IF(d,u,""),y,SWITCH(l,-1,v,0,"",1,w,2,v&w,""),z,IF(e=0,"",e),
       IF(c,x&y&z,"check data")
    )
)
Cell Formulas
RangeFormula
A7,A19,A17,A15,A13,A11,A9A7=FORMULATEXT(A8)
A8A8=T_CHARS(1,,)
A10A10=T_CHARS(,-1,123)
A12A12=T_CHARS(1,1,"bcdf")
A14A14=T_CHARS(1,,""""&"!·$%&/()=?")
A16A16=T_CHARS(,-1,"ZIP-")
A18A18=T_CHARS(,2,""""&"!·$%&/()=?¿<>\@€:;,.-_")
A20A20=T_CHARS(1,2,)
 
Upvote 0
Same functionality, same arguments, tweaks added, omitted able arguments, extra chars "e" can be in any array shape now. Other functions on minisheet: AFILL
Very useful tool in text manipulation functions, for removing, replacing, keeping certain chars.
Excel Formula:
=LAMBDA([d],[l],[e],
    LET(x,1234567890,y,"abcdefghijklmnopqrstuvwxyz",z,UPPER(y),w,TEXTJOIN("",,e),
      a,SWITCH(d,0,"",1,x),b,SWITCH(l,0,"",-1,y,1,z,2,y&z),
      IFNA(a&b&w,"check arg.")
    )
)
LAMBDA 1.1.2.xlsx
ABCDEFGHIJKLMNOPQR
41all digits
5l:letters
60or omitted, no letterswrong argumentsusing quotes
7-1all small lettersd,3d,1,l,4e,|"e,|""
81all capital letters=T_CHARS(3)=T_CHARS(1,4)=T_CHARS(,,"|""")=T_CHARS(,,"|""""")
92small and capital letterscheck arg.check arg.|"|""
10e:extra characters
11string or array of strings,or AFILL construction
12
13all omittedd,1d,omitt.,l,-1d,1,l,-1e,digits 0 to 3e,digits 0 to 3
14=T_CHARS()=T_CHARS(1)=T_CHARS(,-1)=T_CHARS(1,-1)=T_CHARS(,,1230)=T_CHARS(,,"0123")
15 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz12300123
16
17d,omitt.,l,1d,1,l,2
18=T_CHARS(,1)=T_CHARS(1,2)
19ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
20
21d,omitt.,l,2
22=T_CHARS(,2)
23abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
24e,string
25=T_CHARS(,,"\|@#~")
26\|@#~
27e,array
28d,1,e,arrayd,1,e,AFILL constructionAFILL
29%=T_CHARS(1,,A28:B30)=T_CHARS(1,,AFILL({"","%&/"},UNICHAR(9996)&UNICHAR(9200)))
30&/1234567890✌⏰%&/1234567890✌⏰%&/
31Using versatility of AFILL, hybrid array of constant array and formulas/functions
32We can hardcode known unicode chars togheter with a constant string
33
new T_CHARS
Cell Formulas
RangeFormula
G8,D29,H29,D25,F22,J18,F18,D14,N14,P14,J14,F14,B14,J8,L8,N8G8=FORMULATEXT(G9)
G9G9=T_CHARS(3)
J9J9=T_CHARS(1,4)
L9L9=T_CHARS(,,"|""")
N9N9=T_CHARS(,,"|""""")
B15B15=T_CHARS()
D15D15=T_CHARS(1)
F15F15=T_CHARS(,-1)
J15J15=T_CHARS(1,-1)
N15N15=T_CHARS(,,1230)
P15P15=T_CHARS(,,"0123")
F19F19=T_CHARS(,1)
J19J19=T_CHARS(1,2)
F23F23=T_CHARS(,2)
D26D26=T_CHARS(,,"\|@#~")
D30D30=T_CHARS(1,,A28:B30)
H30H30=T_CHARS(1,,AFILL({"","%&/"},UNICHAR(9996)&UNICHAR(9200)))
 

Forum statistics

Threads
1,223,948
Messages
6,175,566
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top