تابعنا

Microsoft Tech Community - Latest Blogs - Excel Blog

الاثنين، 23 ديسمبر 2024

Find the missing letters between first and last letters

 


 Find  the missing letters between first and last letters

BY / 

Meganathan Elumalai







Excel Function - 2 Methods

M-Code - 2 Methods


This challenge is from Excel BI Collections.


Excel Formula:


Method – 1:

=MAP(A2:A8,LAMBDA(x,LET(s,SEQUENCE,str,CODE(x),end,CODE(RIGHT(x)),arr,

 CHAR(s(end-str+1,,str)),TEXTJOIN(", ",,REPT(arr,ISERR(FIND(arr,x)))))))


Method – 2:

=MAP(A2:A8,LAMBDA(x,LET(s,SEQUENCE,str,CODE(x),end,CODE(RIGHT(x)),arr,CHAR(s(

 end-str+1,,str)),TEXTJOIN(", ",,FILTER(arr,ISNA(XMATCH(arr,MID(x,s(LEN(x)),1))),"")))))


M-Code:


Method – 1:

let

 Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],

 Result = Table.AddColumn(Source, "New", (f) =>[txt = f[String], Lst = Text.ToList(txt), str = Text.Start(txt,1),  end = Text.End(txt,1), seq = {str..end}, fin = Text.Combine(List.Difference(seq,Lst), ", ")][fin])

in

 Result


Method – 2:

let

 Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],

 Result = Table.AddColumn(Source, "New", (f) =>[txt = f[String], Lst = Text.ToList(txt),

 str = Text.Start(txt,1), end = Text.End(txt,1), seq = {str..end},

 fin = Text.Combine(List.RemoveMatchingItems(seq,Lst), ", ")][fin])

in

 Result



ليست هناك تعليقات:

إرسال تعليق