Creating reusable functions with LAMBDA

sharshra

Active Member
Joined
Mar 20, 2013
Messages
384
Office Version
  1. 365
I´m aware of creating reusable LAMBDA functions. However, wanted to know if it is possible to create the reusable functions for a piece of formula in which LAMBDA is part.

For example, consider the source table below. Dynamic array is used to sort a column. Is it possible to create a reusable function for the DROP, which includes LAMBDA within it? I intend to use the entire DROP part with varying arrays for TEXTSPLIT function. I may pass different arrays to this reusable function to sort.
Excel Formula:
DROP(REDUCE("",d,LAMBDA(x,y,VSTACK(x,TEXTJOIN(",",TRUE,SORT(TOCOL(TEXTSPLIT(y,","))))))),1)

Source table:
excel problems.xlsx
BCD
2iddesccompare
31dd,aa,mmmismatch-aa
42bbb
53kk,tt,cc,2e
64p,yu
75ij,gt,fx,w,m6tmismatch-m6t
86h
97df,ao
108pmk,q,88,un,zt
119ec,blmatch
121072,hp,fvmatch
Sheet8


Sort:
excel problems.xlsx
K
3aa,dd,mm
4bbb
52e,cc,kk,tt
6p,yu
7fx,gt,ij,m6t,w
8h
9ao,df
1088,pmk,q,un,zt
11bl,ec
1272,fv,hp
Sheet8
Cell Formulas
RangeFormula
K3:K12K3=LET( d,source[desc], dExtract, DROP(REDUCE("",d,LAMBDA(x,y,VSTACK(x,TEXTJOIN(",",TRUE,SORT(TOCOL(TEXTSPLIT(y,","))))))),1), dExtract)
Dynamic array formulas.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
How about
Fluff.xlsm
ABCDK
1
2iddesccompare
31dd,aa,mmmismatch-aaaa,dd,mm
42bbbbbb
53kk,tt,cc,2e2e,cc,kk,tt
64p,yup,yu
75ij,gt,fx,w,m6tmismatch-m6tfx,gt,ij,m6t,w
86hh
97df,aoao,df
108pmk,q,88,un,zt88,pmk,q,un,zt
119ec,blmatchbl,ec
121072,hp,fvmatch72,fv,hp
Main
Cell Formulas
RangeFormula
K3:K12K3=MySort(C3:C12,",")
Dynamic array formulas.
Lambda Functions
NameFormula
MySort=LAMBDA(Data,delim,MAP(Data,LAMBDA(m,TEXTJOIN(delim,,SORT(TEXTSPLIT(m,,delim))))))
 
Upvote 1
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
@Fluff, one related question. If I want to create a reusable function within the formula, not using name manager, how can it be done?
 
Upvote 0
Not sure what you are asking. But you can either put a formula in the Name manager, or you haave to type it out in the cell.
 
Upvote 0

Forum statistics

Threads
1,222,830
Messages
6,168,511
Members
452,194
Latest member
Lowie27

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top