Forum Discussion
DarrylJP
Nov 13, 2022Copper Contributor
Sorting Numbers Withing a Text String
Usually I can think of at least a thought process of where to go, but stumped on this one... I have a text field with a six digit text string, as an example '201210', i would like to sort those si...
- Nov 13, 2022
DarrylJP Below formula may help-
=LET(x,SUBSTITUTE(A1,"'",""),y,MID(x,SEQUENCE(LEN(x)),1),"'"&CONCAT(SORT(y,,-1))&"'")
davidleal
Nov 13, 2022Iron Contributor
If you have the input text in A1, then:
=LET(x, SUBSTITUTE(A1,"'",""),
"'"&TEXTJOIN("",,SORT(MID(x, SEQUENCE(LEN(x)),1),,-1))&"'")
it returns: '221100'