Bird
Raised Fist0
Excelspreadsheet~15 mins

LAMBDA for custom functions in Excel - Real Business Scenario

Choose your learning style10 modes available
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants a quick way to calculate the total price after applying a discount and tax for any product sold. They want a reusable formula to avoid repeating complex calculations.
📊 Data: You have a table with product names, unit prices, quantities sold, discount rates (as decimals), and tax rates (as decimals).
🎯 Deliverable: Create a custom LAMBDA function that calculates the final price after discount and tax, then use it to calculate the total price for each product.
Progress0 / 4 steps
Sample Data
ProductUnit PriceQuantityDiscount RateTax Rate
Notebook1050.10.07
Pen2200.050.07
Backpack5020.150.07
Calculator2530.20.07
Ruler31000.07
1
Step 1: Define a LAMBDA function named FinalPrice that takes four inputs: unit price, quantity, discount rate, and tax rate. The function should calculate the total price after applying the discount and then adding tax.
=LAMBDA(unitPrice, qty, discount, tax, (unitPrice * qty) * (1 - discount) * (1 + tax))
Expected Result
The LAMBDA function is ready to use for calculations.
2
Step 2: Name the LAMBDA function FinalPrice using the Name Manager so it can be reused in the workbook.
Use Excel's Name Manager to create a new name 'FinalPrice' with the formula from step 1.
Expected Result
FinalPrice is available as a custom function in the workbook.
3
Step 3: In a new column next to the data, calculate the final price for each product by calling the FinalPrice function with the corresponding row values.
=FinalPrice(B2, C2, D2, E2)
Expected Result
For Notebook: 10*5=50, discount 10% -> 50*0.9=45, tax 7% -> 45*1.07=48.15
4
Step 4: Copy the formula down for all rows to get the final price for each product.
Drag the formula from the first product row down to the last product row.
Expected Result
Final prices: Notebook=48.15, Pen=40.66, Backpack=90.95, Calculator=80.1, Ruler=32.1
Final Result
Product    Unit Price  Quantity  Discount Rate  Tax Rate  Final Price
---------------------------------------------------------------------
Notebook   10          5         0.1            0.07      48.15
Pen        2           20        0.05           0.07      40.66
Backpack   50          2         0.15           0.07      90.95
Calculator 25          3         0.2            0.07      80.1
Ruler      3           10        0              0.07      32.1
✓The custom LAMBDA function FinalPrice simplifies repeated calculations.
✓Final prices correctly reflect discounts and taxes for each product.
✓Using LAMBDA improves efficiency and reduces formula errors.
Bonus Challenge

Modify the FinalPrice LAMBDA function to include an optional parameter for a fixed shipping fee that adds to the final price only if provided.

Show Hint
Use the IF function inside LAMBDA to check if the shipping fee parameter is missing or zero, then add it accordingly.

Practice

(1/5)
1. What does the LAMBDA function in Excel allow you to do?
easy
A. Convert text to numbers
B. Create your own custom formulas with parameters
C. Automatically sort data in a column
D. Create charts from data ranges

Solution

  1. Step 1: Understand the purpose of LAMBDA

    LAMBDA lets you create custom formulas that can take inputs and return results, like your own mini-functions.
  2. Step 2: Compare with other options

    Sorting, converting text, and creating charts are done by other Excel features, not LAMBDA.
  3. Final Answer:

    Create your own custom formulas with parameters -> Option B
  4. Quick Check:

    LAMBDA = custom formulas [OK]
Hint: LAMBDA = your own formula with inputs [OK]
Common Mistakes:
  • Thinking LAMBDA sorts or formats data
  • Confusing LAMBDA with built-in functions like SORT
  • Assuming LAMBDA creates charts
2. Which of these is the correct syntax to define a LAMBDA function that adds two numbers x and y?
easy
A. =LAMBDA(x, y, x + y)
B. =LAMBDA(x + y)
C. =LAMBDA(x, y; x + y)
D. =LAMBDA(x, y, x - y)

Solution

  1. Step 1: Check LAMBDA syntax

    LAMBDA syntax is =LAMBDA(parameter1, parameter2, ..., calculation). So =LAMBDA(x, y, x + y) is correct.
  2. Step 2: Identify errors in other options

    =LAMBDA(x + y) misses parameters, C uses wrong separator (;), D subtracts instead of adding.
  3. Final Answer:

    =LAMBDA(x, y, x + y) -> Option A
  4. Quick Check:

    Correct LAMBDA syntax uses commas and parameters [OK]
Hint: LAMBDA needs parameters, commas, and a formula [OK]
Common Mistakes:
  • Using semicolons instead of commas
  • Omitting parameters
  • Mixing up addition and subtraction
3. Given the formula =LAMBDA(x, y, x * y)(3, 4), what is the result shown in the cell?
medium
A. 7
B. 34
C. 12
D. Error

Solution

  1. Step 1: Understand the LAMBDA call

    The LAMBDA takes two inputs x and y, then returns x * y. Here, x=3 and y=4.
  2. Step 2: Calculate the multiplication

    3 multiplied by 4 equals 12.
  3. Final Answer:

    12 -> Option C
  4. Quick Check:

    3 * 4 = 12 [OK]
Hint: Multiply inputs inside LAMBDA to get result [OK]
Common Mistakes:
  • Adding instead of multiplying
  • Concatenating numbers as text
  • Expecting an error from correct syntax
4. What is wrong with this LAMBDA formula? =LAMBDA(x, y, x + y(2, 3))
medium
A. Incorrect function call syntax inside LAMBDA
B. Missing closing parenthesis
C. Parameters x and y are not defined
D. LAMBDA cannot add numbers

Solution

  1. Step 1: Analyze the formula structure

    The formula tries to add x + y(2, 3), but y is a parameter, not a function, so y(2, 3) is invalid.
  2. Step 2: Identify the syntax error

    You cannot call parameters like functions inside LAMBDA. The correct call is outside the LAMBDA definition.
  3. Final Answer:

    Incorrect function call syntax inside LAMBDA -> Option A
  4. Quick Check:

    Parameters are values, not callable functions [OK]
Hint: Don't call parameters like functions inside LAMBDA [OK]
Common Mistakes:
  • Trying to call parameters as functions
  • Confusing LAMBDA parameters with named functions
  • Ignoring parentheses placement
5. You want to create a reusable LAMBDA function named DOUBLE that doubles any number input. Which steps correctly create and use this function?
hard
A. Write =DOUBLE(5) without defining DOUBLE anywhere.
B. Write =LAMBDA(x, x*2)(5) directly in a cell without naming it.
C. Define DOUBLE as =LAMBDA(x, x+2) in Name Manager, then use =DOUBLE(5).
D. Define DOUBLE as =LAMBDA(x, x*2) in Name Manager, then use =DOUBLE(5) in a cell.

Solution

  1. Step 1: Define the LAMBDA function correctly

    In Name Manager, create a name DOUBLE with formula =LAMBDA(x, x*2) to double input x.
  2. Step 2: Use the named function in cells

    After defining, use =DOUBLE(5) in any cell to get 10.
  3. Final Answer:

    Define DOUBLE as LAMBDA(x, x*2) and call DOUBLE(5) -> Option D
  4. Quick Check:

    Named LAMBDA + call = reusable function [OK]
Hint: Name LAMBDA in Name Manager, then call by name [OK]
Common Mistakes:
  • Using wrong formula (x+2 instead of x*2)
  • Calling named function without defining it
  • Trying to use LAMBDA without naming for reuse
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard