Professional Documents
Culture Documents
Page 1 of 33
Page 2 of 33
Defined Names
• Picture of Defined Names group in Formula tab in Excel Ribbon :
Page 3 of 33
3. You can create a Defined Name for a Formula or LAMBDA Function using the New Name Dialog Box
by:
• Open Name Manager Dialog Box:
• Formulas tab in Excel Ribbon, Defined Name group, Name Manager button (shown
in above figure).
or
• Use the keyboard to open the Name Manager = Ctrl + F3
• Name Manager Dialog Box looks like this:
• To create a new Defined Name, click the New… button. This opens the New Name Dialog
Box as shown below
• This Defined Name defines a worksheet formula that can be called with an equal
sign and the name “ZeroToTen”:
• This Defined Name defines a LAMBDA re-useable custom function that will create a
new function available in the workbook that will calculate fiscal quarter from a serial
number date:
Page 4 of 33
• Use Defined Names :
1. To Jump to a Defined Name location in workbook, use Name Box dropdown to select name, as
shown here:
ii. After entering Defined Name worksheet formula, this is what you see:
Page 5 of 33
3. To use a Defined Name that is a lookup table:
i. In lookup formula, type first few letters in name, as shown here:
ii. After entering Defined Name lookup Table, this is what you will see:
ii. After invoking the LAMBDA defined function and entering the serial number date (as a
single cell or as a range):
Page 6 of 33
Here is what the Name Manager (Ctrl + F3) looks like when you have many Defined Names (Selected Cells Icon) and
Excel Tables (Table Icon):
Page 7 of 33
• Defined Name Keyboards :
1. Open the Name Manager = Ctrl + F3
2. Create Names From Selection = Ctrl + Shift + F3
3. Paste Name = F3
4. List all Defined Names in Worksheet: F3, then click “Paste Names”.
• Defined Name Warning : Worksheets copied from one workbook to another bring all Defined Names from
source workbook into destination workbook.
LAMBDA Function
• Define LAMBDA function
• The LAMBDA function allows to create a custom function value, which:
1] Can be stored in a Defined Name to create a reusable function
or
2] Can be used in one of six LAMBDA Helper Functions for specific tasks such as spilling an
aggregate calculation across rows. When you use LAMBDA in a helper function you can
use the formula directly in the worksheet or you can store it in a Defined Name to create a
reusable function.
• The arguments for the LAMBDA function are shown here:
Page 8 of 33
• Steps to create a Defined Name LAMBDA custom function for a Rate of Change calculation
1. In the worksheet type your LAMBDA function, as shown below. Note, the parameters that you enter
in the first few arguments of LAMBDA, become the argument labels in the function screen tip. This
means that you should name the parameters in a way that can help the user to understand what to
enter in the function arguments.
If you enter the LAMBDA into the worksheet without testing the formula with formula inputs, you
will see this:
2. To test the LAMBDA function in the worksheet, you type open parentheses, the formulas inputs in
the same order as you entered the parameters in first part of the LAMBDA function, then close
parentheses, as shown here:
Page 9 of 33
3. To create a Defined Name for the LAMBDA function (this allows you to re-use function anywhere in
workbook), copy the LAMBDA function you created in the worksheet (without the testing
parentheses at end) and then:
i. Use Ctrl + F3 to open Name Manager
ii. Click New Name button
iii. In the New Name dialog box, enter:
1) Name: The name of the function (will appear in function dropdown list when you
create formulas)
2) Scope: Where you want the function to appear: in Workbook (available everywhere
in workbook) or a specified worksheet name.
3) Comment: Create a description of the function (this appears in function screen tip
when typing function name in a formula)
4) Refers to: Paste the LAMBDA function you created in the worksheet (without the
testing parentheses at end).
4. Test new function in worksheet by typing an equal sign and then the first few letters in function
name (screen tip with description pops up), as shown here:
6. Test the output of the new Defined Name LAMBDA function, as shown here:
Page 10 of 33
• You can use the Advanced Formula Environment to create a Defined Name LAMBDA custom
functions
• The Advanced Formula Environment is an Excel Worksheet Add-in that is not installed by default in
your Excel version. As shown below, you can install it with the Get-Add-ins button in the Add-ins
group in the Insert tab in the Excel Ribbon. However, many work entities have the Add-ins feature
disabled. You can contact your network administrator to have it installed. Otherwise, you can create
your LAMBDA custom functions with using this task pane and use the Defined Name Dialog Box to
create your LAMBDA re-usable custom function.
• To open the Advanced Formula Environment, go to the Formula tab in the Excel Ribbon as shown
below:
Page 11 of 33
• Steps to create a Defined Name LAMBDA custom function for a COGS calculation
1. Create and test in worksheet:
Page 12 of 33
• Defined Name LAMBDA custom function for a show formula text in vertical column formula
Page 14 of 33
• Examples of BYROW and BYCOL LAMBDA Helper Functions to spill aggregate calculations
Page 15 of 33
• Use MAP on Single Column or Single Row rather than BYROW or BYCOL
Page 16 of 33
• Examples of SCAN LAMBDA Helper Function
This example shows how to use SACN to iterate across an array and deliver each intermediate amount, like in a
running total. SCAN also is the function method to simulate a Relative Cell Reference in a spilled array.
Page 17 of 33
• Examples of REDUCE LAMBDA Helper Function
This example shows how to use REDUCE to iterate across an array and deliver the final result after all iterations.
Page 18 of 33
Page 19 of 33
• Example of Recursion in the LAMBDA function
Page 20 of 33
Example of MAKRARRAY LAMBDA Helper Function
Page 21 of 33
LET Function
• Define LET function: The LET function allows you to define variables within the function and use those variables
to make a calculation. Use LET when you have repeating formula elements or when you want to make complex
formulas easier to read. Let arguments are here:
• Advantages of LET:
o A variable is evaluated a single time, and the result is stored in memory so that it can be used
throughout a formula. For formulas with repeating formula elements, this can reduce overall calculation
time by preventing duplication of evaluation procedures.
o Formulas with repeating elements are easy to edit because you have to edit in only one location.
o Complex formulas can be visually easy to read because each element has a name and can be placed on a
different line with the line feed keyboard shortcut, Alt+Enter.
o You can build single cell report formulas more efficiently with the LET function.
Steps to Build LET & LAMBDA Functions for Single Cell Report
• Step 1: Build LET Part of formula:
Page 22 of 33
• Step 2: Add LAMBDA part to formula and then save as a Defined Name:
Page 23 of 33
• Step 4: Add Conditional Formatting
Page 24 of 33
LET & Lambda Functions to make Dynamic Cross Tab Report
Page 25 of 33
Example of LAMBDA Function that can Create Four Different Types of Reports
Page 26 of 33
Custom LAMBDA & LET Function to Calculate Return and Standard Deviation for Portfolio of Stocks
Page 27 of 33
Custom LAMBDA & LET Function to Enhance the built-in Statistics Function LINEST
Page 28 of 33
All Defined Names From Video
No. Type Name Description of Defined Name Defined Name Definition
This function calculates Cost Of
Goods Sold (COGS) based on
number of units at the
beginning of the period (Begin),
1 LAMBDAs COGS =LAMBDA(Begin, End, Value, (Begin - End) * Value)
number of units at the end of
the period (End) and the value
per unit (Value) using the
formula: (Begin-End)*Value.
=LAMBDA(Table,RowCriteria,ColumnCriteria,SumColumn,
LET(
t, Table,
rhcr, RowCriteria,
chcr, ColumnCriteria,
This function makes a scr, SumColumn,
summation cross tabulated h, TAKE(t,1),
report with the function d, DROP(t,1),
argument formula inputs: Table rhc, INDEX(d, , XMATCH(rhcr, h)),
2 LAMBDAs CrossTabReport (headers and data), field name chc, INDEX(d, , XMATCH(chcr, h)),
for row header condition, field sc, INDEX(d, , XMATCH(scr, h)),
name for column header rhu, SORT(UNIQUE(rhc)),
condition and field name for chu, TOROW(SORT(UNIQUE(chc))),
column to sum. tr, EXPAND("Total "&scr, , COLUMNS(chu)+2,""),
fr, HSTACK(rhcr&"/"&chcr, chu, "Total"),
mr, HSTACK(rhu,SUMIFS(sc, rhc, rhu, chc, chu),SUMIFS(sc, rhc, rhu)),
lr, HSTACK("Total", SUMIFS(sc, chc, chu), SUM(sc)),
Page 29 of 33
Page 30 of 33
No. Type Name Description of Defined Name Defined Name Definition
This function allows you to
enter a serial number date and
6 LAMBDAs FiscalQuarter the function will deliver a fiscal =LAMBDA(Date,"Q" & LOOKUP(MONTH(Date), {1,3;4,4;7,1;10,2}))
quarter based on July 1 as first
day in Fiscal Year.
This function calculates the rate
7 LAMBDAs RateOfChange of change given a begin amount =LAMBDA(Begin, End, End/Begin-1)
and an end amount.
=LAMBDA(Begin, End,
This function calculates the rate
IFS(
of change given a begin amount
RateOfChange AND(ISOMITTED(Begin), ISOMITTED(End)), "Enter Both Begin and End Amounts",
8 LAMBDAs and an end amount. This has a
ErrorM ISOMITTED(Begin), "Please Enter Begin",
message if an argument is left
ISOMITTED(End), "Please Enter End",
empty.
TRUE, End/Begin-1))
=LAMBDA(Text, CharToRemove,
IF(CharToRemove="",
This function uses recursion to
TRIM(Text),
9 LAMBDAs RemoveChar remove the specified digits
RemoveChar(
from a text string.
SUBSTITUTE(Text, LEFT(CharToRemove), ""),
RIGHT(CharToRemove, LEN(CharToRemove)-1))))
=LAMBDA(Text, CharactersToRemove,
Remove specified characters
TRIM(REDUCE(Text,
10 LAMBDAs RemoveCharR listed in a single cell using
MID(CharactersToRemove, SEQUENCE(LEN(CharactersToRemove)), 1),
REDUCE.
LAMBDA(i, a, SUBSTITUTE(i, a, "")))))
=LAMBDA(text,
This function will remove the REDUCE(
RemoveNumbers
11 LAMBDAs digits 0,1,2,3,4,5,6,7,8,9 from a text,
FromText
test string. SEQUENCE(10,,0),
LAMBDA(i,a, SUBSTITUTE(i, a, ""))))
Page 31 of 33
No. Type Name Description of Defined Name Defined Name Definition
=LAMBDA(Text,
TRIM(REDUCE(
This function will insert spaces
13 LAMBDAs SpaceBeforeCaps Text,
before capital letters.
CHAR(SEQUENCE(26, , 65)),
LAMBDA(i,a, SUBSTITUTE(i, a, " "&a)))))
This function takes the ourput =LAMBDA(Yvalues,Xvalues,
from the LINEST function and LET(
XYRegression
14 LAMBDAs labels each statistical output labels,{"Slope m";"Standard Error m";"R^2";"F";
10Stats
and lists the labels and statistics "SS Regression";"Intercept b";"Standard Error b";"Standard Error y";"df";"SS Residual"},
in a vertical array. stats,TOCOL(LINEST(Yvalues,Xvalues,1,1),,1),HSTACK(labels,stats)))
Page 32 of 33
No. Type Name Description of Defined Name Defined Name Definition
Approximate Match Lookup
Table to convert month number
FiscalQLookup
15 Formulas to fiscal quarter number where ={1,3;4,4;7,1;10,2}
Table
July 1 is first month in fiscal
quarter.
Three Non-contiguous ranges
16 Formulas TestScores =DefinedNames!$J$7:$J$14, DefinedNames!$L$7:$L$14, DefinedNames!$N$7:$N$14
with related test scores.
Name creates a vertical array of
17 Formulas ZeroToTen =SEQUENCE(11, , 0)
numbers from 0 to 10.
This is the Begin Amount that is
18 Ranges Begin =DefinedNames!$B$7
related to an End Amount.
This is the End Amount that is
19 Ranges End =DefinedNames!$C$7
related to an Begin Amount.
Named field from sales table on
20 Ranges Product =DefinedNames!$G$7:$G$19
the Defined Name worksheet.
Page 33 of 33