As a footnote, very recent builds of macOS MS Excel (those which support LAMBDA
expressions in cell formulae) allow you to define and name a custom function which does this:
The help system in these builds shows you how to:
- test a formula,
- wrap it in
=LAMBDA(valueName, outputValueFormula)
,
- and then give this custom function a name under
Formulas > Define Name
.
for example, if we have defined a custom function which returns an Array version of an input string, and given it the name CHARS
under Formulas > Define Name
:
=LAMBDA(string, MID(string,ROW(INDIRECT("1:"&LEN(string))),1))
we can then use CHARS
inside the definition of another custom function – let's call it SPACEDCHARS
:
=LAMBDA(S, CONCAT(LAMBDA(x, x & " ")(CHARS(S))))
and then use SPACEDCHARS
as in the screenshot above.
e.g.
=SPACEDCHARS(B4)
and, FWIW, another definition of SPACEDCHARS
(combining our user-defined CHARS
with the built-in TEXTJOIN
), might be:
=LAMBDA(s, TEXTJOIN(" ",TRUE,CHARS(s)))
To summarize:
CHARS
=LAMBDA(s, MID(s, ROW(INDIRECT("1:"&LEN(s))), 1))
SPACEDCHARS
=LAMBDA(s, TEXTJOIN(" ", TRUE, CHARS(s)))
Under Formulas > Define Name
:
The part that I might use Keyboard Maestro for is:
- The storage of a collection of such definitions
- and the export of some sub-set of them into a selected Excel workbook.
lambdaExample.xlsx.zip (8.0 KB)