Search code examples
sortinggoogle-sheetsformula

Sorting the string combined with arrayformula()


I have this data in Col A and the result I want in col B : enter image description here

I want to create arrayformula in col B so it will take the string from col A and sort it.

if without using arrayformula() then per row I can use this formula (for example in col B1) :

=join(",",sort(tocol(split(A1,","))))

My question how to combine it with the arrayformula() to automatically apply for every value in col A. I tried this one but doesn't work :

=ARRAYFORMULA( join(",",sort(tocol(split(A1:A,",")))) )

Solution

  • Use MAP() or BYROW() function. Try-

    =MAP(TOCOL(A:A,1),LAMBDA(r,JOIN(",",SORT(TOCOL(SPLIT(r,","),1)))))
    

    enter image description here