تابعنا

Microsoft Tech Community - Latest Blogs - Excel Blog

الأحد، 22 ديسمبر 2024

Numerous ways in Excel to Accomplish a Task

 

Numerous ways in Excel to Accomplish a Task






Excel Function - 4 Methods
M-Code - 2 Methods

This challenge is from Omid Motamedisedeh Collections.

Excel Formula:

Method – 1:
=MAP(B3:B7,LAMBDA(x,TEXTBEFORE(TEXTAFTER(x,{"(","[","{"}),{")","]","}"})))
Method – 2:
=MAP(B3:B7,LAMBDA(x,TEXTSPLIT(TAKE(TEXTSPLIT(x,{"(","{","["}),,-1),{")","}","]"})))
Method – 3:
=MAP(B3:B7,LAMBDA(x,LET(txt,REPLACE(x,1,MAX(IFERROR(FIND({"(","{","["},x),)),),
 MID(txt,1,MAX(IFERROR(FIND({")","}","]"},txt),))-1))))
Method – 4:
=BYROW(B3:B7,LAMBDA(x,LET(txt,SUBSTITUTE(x,MID(x,MAX(IFERROR(FIND({")","}","]"},x),)),100),),
 MID(txt,MAX(IFERROR(FIND({"(","{","["},txt),))+1,100))))

M-Code:

Method – 1:
let
 Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
 Result = Table.AddColumn(Source, "New", (f) => [t = Text.SplitAny, fin = t(t(f[Text],"({["){1},")}]"){0}][fin])
in
 Result
Method – 2:
let
 Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
 Result = Table.AddColumn(Source,"Ans", (f) =>
 [
 t = Text.PositionOfAny,
 txt = Text.RemoveRange( f[Text],0, t(f[Text], {"(","{","["}) + 1 ),
 fin = Text.Start(txt, t(txt, {")","}","]"}))
 ][fin])
in
 Result

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

إرسال تعليق