google-sheetslambdagoogle-sheets-formulasequencetextjoin

How to Flip a string in google sheets


I have this google sheets input column on the left, I want to flip the string like shown in the output column.

Input   Output
--------------
bats    stab
live    evil
meet    teem
part    trap
stop    pots

Solution

  • Split the string to it's characters using delimiter, then REDUCE the string using current&accumulator(reversal happens here):

    =REDUCE(,SPLIT(REGEXREPLACE(A2,,"🐾"),"🐾"),LAMBDA(a,c,c&a))
    

    For a array, use BYROW:

    =BYROW(A2:INDEX(A2:A,COUNTA(A2:A)),LAMBDA(str,REDUCE(,SPLIT(REGEXREPLACE(str,,"🐾"),"🐾"),LAMBDA(a,c,c&a))))