Home > Software design >  SUBSTITUTE or REPLACE all non-alphanumeric characters
SUBSTITUTE or REPLACE all non-alphanumeric characters

Time:03-10

This array formula (CTRL SHIFT ENTER) trim any non-alphanumeric characters:

{=TEXTJOIN("";1;MID(D2;ROW(INDIRECT("1:"&LEN(D2)))*IFERROR(SEARCH(MID(D2;ROW(INDIRECT("1:"&LEN(D2)));1);"-./ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0;LEN(D2) 1);1))}

But I want to substitute/replace this non-alphanumeric characters with simple space, only with regular or array formula. Its possible?

CodePudding user response:

It seems you can use the following:

enter image description here

The CSE-entered formula in B1:

=TRIM(CONCAT(IF(ISNUMBER(SEARCH(MID(A1,ROW(A$1:INDEX(A:A,LEN(A1))),1),"-./ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")),MID(A1,ROW(A$1:INDEX(A:A,LEN(A1))),1)," ")))

It will also prevent your formula from being volatile.

  • Related