Home » List Tautonym words

List Tautonym words

List Tautonym words. Tautonym words are those where one half of the word is same as the other half. Ex. Bonbon, Lynx lynx

📌 Challenge Details and Links
ExcelBI Excel Challenge Number: 294
Challenge Difficulty: ⭐️
📥Download Sample File
📥Link to the solutions on LinkedIn

Solving the challenge of List Tautonym words with Power Query

Power Query solution 1 for List Tautonym words, proposed by Bo Rydobon 🇹🇭:
let
 Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
 Ans = Table.SelectRows(Source, each let m = Number.IntegerDivide(Text.Length([Words]),2) in Text.Lower(Text.Start([Words],m)) = Text.End([Words],m) )
in
 Ans


check middle word for non alphabet
let
 Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
 Ans = Table.SelectRows(Source, each let w = Text.Select(Text.Lower([Words]),{"a".."z"}) , m = Text.Length(w) in Number.IsEven(m) and Text.Start(w,m/2) = Text.End(w,m/2) )
in
 Ans


                    
                  
          
Power Query solution 2 for List Tautonym words, proposed by Zoran Milokanović:
let
  Source = Excel.CurrentWorkbook(){[Name = "Input"]}[Content], 
  S = Table.SelectRows(
    Source, 
    each 
      let
        l = Number.RoundDown(Text.Length([Words]) / 2), 
        t = Text.Upper([Words])
      in
        Text.Start(t, l) = Text.End(t, l)
  )
in
  S
Power Query solution 3 for List Tautonym words, proposed by Aditya Kumar Darak 🇮🇳:
let
  Source = Excel.CurrentWorkbook(){[Name = "data"]}[Content], 
  Return = Table.SelectRows(
    Source, 
    each [
      C = Int64.From(Text.Length([Words]) / 2 - 0.01), 
      L = Text.Lower([Words]), 
      R = Text.EndsWith(L, Text.Start(L, C))
    ][R]
  )
in
  Return
Power Query solution 4 for List Tautonym words, proposed by Alejandro Simón 🇵🇦 🇪🇸:
let
  Source = Excel.CurrentWorkbook(){[Name = "Table1"]}[Content], 
  Sol = Table.SelectRows(
    Source, 
    each 
      let
        a = Text.ToList(Text.Upper(Text.Remove([Words], {" ", "-"}))), 
        b = List.Split(a, Int64.From(List.Count(a) / 2)), 
        c = b{0} = b{1}
      in
        c
  )
in
  Sol
Power Query solution 5 for List Tautonym words, proposed by Luan Rodrigues:
let
  Fonte = Tabela1, 
  res = Table.SelectRows(
    Fonte, 
    each [
      a = Text.ToList(Text.Select(Text.Lower([Words]), {"a" .. "z"})), 
      b = try List.FirstN(a, List.Count(a) / 2) = List.LastN(a, List.Count(a) / 2) otherwise null
    ][b]
  )
in
  res
Power Query solution 6 for List Tautonym words, proposed by Ramiro Ayala Chávez:
let
  Origen = Excel.CurrentWorkbook(){[Name = "Tabla1"]}[Content], 
  D = Table.DuplicateColumn(Origen, "Words", "D"), 
  M = Table.TransformColumns(D, {{"D", Text.Lower}}), 
  R1 = Table.ReplaceValue(M, "-", "", Replacer.ReplaceText, {"D"}), 
  R2 = Table.ReplaceValue(R1, " ", "", Replacer.ReplaceText, {"D"}), 
  Length = Table.AddColumn(R2, "Length", each Text.Length([D])), 
  F = Table.AddColumn(Length, "F", each Text.Start([D], Number.RoundDown([Length] / 2))), 
  L = Table.AddColumn(F, "L", each Text.End([D], Number.RoundUp([Length] / 2))), 
  P = Table.AddColumn(L, "Answer Expected", each if [F] = [L] then [Words] else "")[
    [Answer Expected]
  ], 
  Sol = Table.SelectRows(P, each ([Answer Expected] <> ""))
in
  Sol
Power Query solution 7 for List Tautonym words, proposed by Luke Jarych:
let
  Source = Table1, 
  NumberAdded = Table.AddColumn(
    Source, 
    "NumberInHalf", 
    each Number.RoundDown(Text.Length([Words]) / 2)
  ), 
  #"Added Custom1" = Table.AddColumn(NumberAdded, "UpperWord", each Text.Upper([Words])), 
  #"Added Custom" = Table.AddColumn(
    #"Added Custom1", 
    "Custom", 
    each Text.Start([UpperWord], [NumberInHalf]) = Text.End([UpperWord], [NumberInHalf])
  ), 
  #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = true)), 
  #"Removed Columns" = Table.RemoveColumns(
    #"Filtered Rows", 
    {"NumberInHalf", "UpperWord", "Custom"}
  )
in
  #"Removed Columns"
Power Query solution 8 for List Tautonym words, proposed by Kalyan Kumar Reddy Kethireddy:
let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WcirNSSrNUYrVATLz85Ly8/Mg7MpU3aTKVDDbObEkMScTIh5UmldUCmW7l+bkK6QDCTAvILEgEaI1NScnUSEJSIK5jgWlxQqJQEIpNhYA", 
          BinaryEncoding.Base64
        ), 
        Compression.Deflate
      )
    ), 
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [Words = _t]
  ), 
  #"Tautonym Words" = Table.SelectRows(
    Source, 
    each [
      a = Text.Select([Words], {"A" .. "Z", "a" .. "z"}), 
      b = Text.Length(a), 
      c = try Text.Upper(Text.Start(a, b / 2)) = Text.Upper(Text.End(a, b / 2)) otherwise false
    ][c]
  )
in
  #"Tautonym Words"
Power Query solution 9 for List Tautonym words, proposed by ASHFAQUE AHMED:
= Table.SelectRows(Source, each Text.Start([Words], Text.Length([Words]) / 2) = Text.End([Words], Text.Length([Words]) / 2))

Solving the challenge of List Tautonym words with Excel

Excel solution 1 for List Tautonym words, proposed by Bo Rydobon 🇹🇭:
=LET(
    a,
    A2:A10,
    m,
    LEN(
        a
    )/2,
    FILTER(
        a,
        LEFT(
            a,
            m
        )=RIGHT(
            a,
            m
        )
    )
)

check middle word for non alphabet
=LET(a,
    A2:A10,
    m,
    LEN(
        a
    )/2,
    c,
    IF(
        MOD(
            m,
            1
        ),
        MID(
            a,
            m+1,
            1
        ),
        
    ),
    
FILTER(a,
    (LEFT(
            a,
            m
        )=RIGHT(
            a,
            m
        ))*EXACT(
        UPPER(
            c
        ),
        LOWER(
            c
        )
    )))
Excel solution 2 for List Tautonym words, proposed by Rick Rothstein:
=LET(a,
    A2:A10,
    m,
    LEN(
        a
    )/2,
    t,
    (MATCH(
        IF(
            ISODD(
                2*m
            ),
            MID(
                a,
                m+1,
                1
            ),
            "@"
        ),
        {"@",
        " ",
        "-",
        "/"},
        0
    )),
    FILTER(a,
    (LEFT(
        a,
        m
    )=RIGHT(
        a,
        m
    ))*ISNUMBER(
        t
    )))
Excel solution 3 for List Tautonym words, proposed by John V.:
=LET(
    w,
    A2:A10,
    c,
    LEN(
        w
    )/2,
    FILTER(
        w,
        LEFT(
            w,
            c
        )=RIGHT(
            w,
            c
        )
    )
)
Excel solution 4 for List Tautonym words, proposed by محمد حلمي:
=FILTER(
    A2:A10,
    MAP(
        A2:A10,
        LAMBDA(
            a,
            
            LEFT(
                a,
                LEN(
                    a
                )/2
            )=RIGHT(
                a,
                LEN(
                    a
                )/2
            )
        )
    )
)
Excel solution 5 for List Tautonym words, proposed by محمد حلمي:
=LET(a,A2:A10,i,LEN(a)/2,FILTER(a,LEFT(a,i)=RIGHT(a,i)))
Excel solution 6 for List Tautonym words, proposed by محمد حلمي:
=LET(
a,
    A2:A10,
    
v,
    LEN(
        a
    ),
    
i,
    v/2,
    
FILTER(a,
    IF(
        ISODD(
            v
        ),
        ISNA(
            XMATCH(
                MID(
                    a,
                    i+1,
                    1
                ),
                
                CHAR(
                    ROW(
                        65:90
                    )
                )
            )
        ),
        1
    )*(LEFT(
        a,
        i
    )=RIGHT(
        a,
        i
    ))))
Excel solution 7 for List Tautonym words, proposed by Kris Jaganah:
=TOCOL(MAP(A2:A10,
    LAMBDA(x,
    LET(a,
    MID(
        x,
        SEQUENCE(
            LEN(
                x
            )
        ),
        1
    ),
    b,
    FILTER(a,
    (a<>"-")*(a<>" ")),
    c,
    ROUNDUP(
        ROWS(
            b
        )/2,
        0
    ),
    IFS(MIN(--(TAKE(
        b,
        c
    )=TAKE(
        b,
        -c
    ))),
    x)))),
    3)
Excel solution 8 for List Tautonym words, proposed by Timothée BLIOT:
=LET(
    A,
    SUBSTITUTE(
        SUBSTITUTE(
            A2:A10,
            " ",
            ""
        ),
        "-",
        ""
    ),
    B,
    LEN(
        A
    ),
    FILTER(
        A2:A10,
        IF(
            MOD(
                B,
                2
            ),
            0,
            LEFT(
                A,
                B/2
            )=MID(
                A,
                B/2+1,
                B/2
            )
        )
    )
)
Excel solution 9 for List Tautonym words, proposed by Hussein SATOUR:
=FILTER(
    A2:A10,
     MAP(
         A2:A10,
          LAMBDA(
              x,
               LET(
                   a,
                    INT(
                        LEN(
                            x
                        )/2
                    ),
                    LEFT(
                        x,
                         a
                    ) = RIGHT(
                        x,
                         a
                    )
               )
          )
     )
)
Excel solution 10 for List Tautonym words, proposed by Sunny Baggu:
=LET(
    
     _words,
     A2:A10,
    
     _tb,
     TEXTBEFORE(
         _words,
          {" ",
          "-"},
          ,
          1,
          1,
          _words
     ),
    
     _ta,
     TEXTAFTER(
         _words,
          {" ",
          "-"},
          ,
          1,
          1,
          _words
     ),
    
     _cond1,
     _tb = _ta,
    
     _cond2,
     LET(
         
          _len,
          LEN(
              _words
          ),
         
          IF(
              ISEVEN(
                  _len
              ),
               LEFT(
                   _words,
                    _len / 2
               ) = RIGHT(
                   _words,
                    _len / 2
               ),
               FALSE
          )
          
     ),
    
     FILTER(
         _words,
          MAP(
              _cond1,
               _cond2,
               LAMBDA(
                   c,
                    d,
                    OR(
                        c,
                         d
                    )
               )
          )
     )
    
)
Excel solution 11 for List Tautonym words, proposed by Julien Lacaze:
=FILTER(
    A2:A10,
     MAP(
         A2:A10,
         
         LAMBDA(
             a,
             LEFT(
                 a,
                 INT(
                     LEN(
                         a
                     )/2
                 )
             )=RIGHT(
                 a,
                 INT(
                     LEN(
                         a
                     )/2
                 )
             )
         )
     )
)
Excel solution 12 for List Tautonym words, proposed by Pieter de Bruijn:
=LET(
    a,
    A2:A10,
    u,
    UPPER(
        a
    ),
    TOCOL(
        IFS(
            MID(
                u,
                1,
                LEN(
        a
    )/2
            )=MID(
                u,
                ROUND(
                    LEN(
        a
    )/2,
                    
                )+1,
                LEN(
        a
    )
            ),
            a
        ),
        2
    )
)

=LET(a,
    A2:A10,
    l,
    LEN(
        a
    ),
    h,
    l/2,
    FILTER(a,
    (LEFT(
        a,
        h
    )=RIGHT(
        a,
        h
    ))*(IF(
        MOD(
            l,
            2
        ),
        MMULT(
            IFERROR(
                SEARCH(
                    MID(
                        a,
                        h+1,
                        1
                    ),
                    CHAR(
                        TOROW(
                            ROW(
                                65:90
                            )
                        )
                    )
                ),
                0
            ),
            SEQUENCE(
                ROW(
                                65:90
                            ),
                ,
                ,
                0
            )
        )=0,
        1
    ))))

second formula was after reading Rick Rothstein's post. I'd have to agree with the first not being sufficient (apart from Bo's formula using left and right being much cleaner)
Excel solution 13 for List Tautonym words, proposed by Nicolas Micot:
=LET(
    _mots;
    A4:A12;
    
    FILTRE(
        _mots;
        MAP(
            _mots;
            LAMBDA(
                l_mot;
                
                LET(
                    _longueur;
                    ARRONDI.INF(
                        NBCAR(
                            l_mot
                        )/2;
                        0
                    );
                    
                    GAUCHE(
                        l_mot;
                        _longueur
                    )=DROITE(
                        l_mot;
                        _longueur
                    )
                )
            )
        )
    )
)
Excel solution 14 for List Tautonym words, proposed by Giorgi Goderdzishvili:
=LET(
arr,A2:A10,
mp,MAP(arr,LAMBDA(x, LET(
wr,x,
md, INT(LEN(wr)/2),
fr, MID(wr,SEQUENCE(,md),1),
sc, MID(wr,SEQUENCE(,md,md+1+1*ISODD(LEN(wr))),1),
chck, SUM(--(fr=sc))=md,
chck))),
FILTER(arr,mp))
Excel solution 15 for List Tautonym words, proposed by Daniel Garzia:
=LET(
    i,
    A2:A10,
    l,
    LEN(
        i
    )/2,
    FILTER(
        i,
        LEF&T(
            i,
            l
        )=RIGHT(
            i,
            l
        )
    )
)
Excel solution 16 for List Tautonym words, proposed by samir tobeil:
=LET(a,A2:A10,s,LEN(a)/2,FILTER(a,ISNUMBER(SEARCH(LEFT(a,s),a,2))))
Excel solution 17 for List Tautonym words, proposed by Rayan S.:
=LET(
 n,
     LEN(
         A2:A10
     ),
    
 l,
     LEFT(
         A2:A10,
          n / 2
     ),
    
 r,
     RIGHT(
         A2:A10,
          n / 2
     ),
    
 x,
     IF((l = r) = TRUE,
     A2:A10,
     0),
    
 FILTER(
     x,
      ISTEXT(
          x
      )
 )
)
Excel solution 18 for List Tautonym words, proposed by Amardeep Singh:
=LET(r,
    A2:A10,
    
i,
    LEN(
        r
    ),
    
c,
    CODE(UPPER(MID(r,
    (i+1)/2,
    1))),
    
chk,
    IF(NOT(ISODD(
        i
    )* (c>=65)* (c<=90)),
     LEFT(
         r,
         i/2
     )=RIGHT(
         r,
         i/2
     ),
    0),
    
FILTER(
    r,
    chk
))
Excel solution 19 for List Tautonym words, proposed by Harry Seiders:
=FILTER(A2:A10,MAP(A2:A10,LAMBDA(ck,LET(part,INT(LEN(ck)/2),A,LEFT(ck,part),B,RIGHT(ck,part),--(A=B)))))

Solving the challenge of List Tautonym words with Python in Excel

Python in Excel solution 1 for List Tautonym words, proposed by Bo Rydobon 🇹🇭:
[a for a in xl("A2:A10")[0] if a[:len(a)//2].lower()==a[-(len(a)//2):]]
[a for a in xl("A2:A10")[0] if a[:(m:=len(a)//2)].lower()==a[-m:] and (len(a)%2==0 or a[m].lower() == a[m].upper())]
                    
                  
Python in Excel solution 2 for List Tautonym words, proposed by John V.:
Hi everyone!
One (Python) option could be:
Blessings!
                    
                  

Solving the challenge of List Tautonym words with R

R solution 1 for List Tautonym words, proposed by Konrad Gryczan, PhD:
library(tidyverse)
library(readxl)
input = read_excel("Tautonyms.xlsx", range = "A1:A10")
test = read_excel("Tautonyms.xlsx", range = "B1:B6")
is_tautonym = function(string) {
 low_str = str_to_lower(string)
 
 cleaned_str = low_str %>% 
 str_remove_all(pattern = "[:punct:]") %>%
 str_remove_all(pattern = "[:space:]")
 
 str_len = str_length(cleaned_str)
 
 if (str_len %% 2 != 0) {
 return(FALSE)
 } else {
 first_part = str_sub(cleaned_str, 1, str_len/2)
 second_part = str_sub(cleaned_str, (str_len/2)+1, str_len)
 return(first_part == second_part)
 }
}
result = input %>%
 mutate(is_tautonym = map_lgl(Words, is_tautonym)) %>%
 filter(is_tautonym == TRUE) %>%
 select(`Answer Expected` = Words)
                    
                  

&&

Leave a Reply