CODEX

Introducing the New LAMBDA Function in Excel

Another game-changer from Microsoft

Andrew Moss
Feb 8 · 9 min read

LAMBDA Basics

=LAMBDA(parameter_or_calculation, …
Source: microsoft.com

Example Workbook

Part 1 — Simple Examples

Example 1

=LAMBDA(x,y,x+y)(5,3)
=AddTwoNumbers(5,3)

Example 2

=LAMBDA(FirstName,LastName,FirstName&" "&LastName
)(G17:G21,H17:H21)

Example 3

=LAMBDA(FirstName,LastName,
LOWER(FirstName&"."&LastName&"@email.com")
)(G27:G31,H27:H31)

Part 2—Filter Table Based on User Selection

Example 4

=LAMBDA(Player,SORT(CHOOSE({1,2,3},Player,INDEX(Table1[Fee],SEQUENCE(ROWS(Player),,XMATCH(INDEX(Player,1),Table1[Player]))),
INDEX(Table1[Year],SEQUENCE(ROWS(Player),,XMATCH(INDEX(Player,1),Table1[Player])))
),{2,3},-1,-1))(I16:I18)
INDEX(TransfersTable[Fee/Year],SEQUENCE(ROWS(Player),,
XMATCH(INDEX(Player,1),TransfersTable[Player]))),

Part 3—Recursion

Example 5

=LAMBDA(ClubName,ExcludeCharacters,IF(ExcludeCharacters="",ClubName,CleanName(SUBSTITUTE(ClubName,LEFT(ExcludeCharacters,1),""),
RIGHT(ExcludeCharacters,LEN(ExcludeCharacters)-1))
))(G14:G23,$G$11)

Example 6

=LAMBDA(NumberGroup,
SUM(--MID(NumberGroup,SEQUENCE(LEN(NumberGroup)),1))
)(G30)
=LAMBDA(NumberGroup,AddedNumbers,x,IF(x=LEN(NumberGroup)+1,AddedNumbers,AddNumbersRecursive(NumberGroup,AddedNumbers+MID(NumberGroup,x,1),x+1)))(G34,0,1)
AddNumbersRecursive(NumberGroup,AddedNumbers+MID(NumberGroup,x,1),x+1)
=AddNumbersRecursive(G34,0,1)

Final Words

CodeX

Everything connected with Tech & Code

Andrew Moss

Written by

I mainly focus on Excel-related content in my articles, often providing example workbooks to download, too. https://www.linkedin.com/in/andrewcharlesmoss

CodeX

CodeX

Everything connected with Tech & Code

Andrew Moss

Written by

I mainly focus on Excel-related content in my articles, often providing example workbooks to download, too. https://www.linkedin.com/in/andrewcharlesmoss

CodeX

CodeX

Everything connected with Tech & Code

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store