How to Create an Optional Argument in an Excel LAMBDA Function
Question details
The user needs to know how to properly implement an optional argument in a custom LAMBDA function without triggering calculation errors.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating a complex custom formula where certain inputs, such as a second grouping range, are optional for the user to provide.
- Observed behavior
- The LAMBDA function returns a 'You have entered too few arguments' error when the secondary grouping range is made optional with square brackets.
Verify that your spreadsheet application version supports the LAMBDA and ISOMITTED functions, as these are required for creating and evaluating optional custom parameters.
Format and Evaluate Optional Arguments Using ISOMITTED
To prevent argument errors, optional parameters must be placed at the end of the LAMBDA parameter list, and the ISOMITTED function must be used to dictate the formula's behavior when the parameter is left blank.
When defining custom parameters inside a LAMBDA function, any parameter wrapped in square brackets (e.g., [GroupBy2]) is treated as optional. However, Excel requires all optional arguments to be positioned after the required arguments.
Furthermore, simply wrapping the parameter in brackets is not enough. You must wrap the parameter's execution logic in an IF and ISOMITTED statement so the formula knows exactly what to calculate if the user leaves the argument empty.
In your LAMBDA definition, ensure that your optional argument with square brackets is listed last. For example: =LAMBDA(SumRange, GroupBy1, [GroupBy2], ...)
Use the ISOMITTED function inside a LET or IF statement to check if the user provided the optional argument. For example: IF(ISOMITTED(GroupBy2), UNIQUE(GroupBy1), UNIQUE(HSTACK(GroupBy1, GroupBy2))).
Provide a fallback calculation for when ISOMITTED returns TRUE (meaning the argument was not provided) and the standard calculation for when it returns FALSE.
Apply your custom function in a cell by testing it both with and without the optional argument to ensure neither scenario returns a 'too few arguments' error.

Master Advanced Data Calculations with WPS Spreadsheet
WPS Spreadsheet offers a robust, user-friendly environment for handling complex logical functions and array formulas. Easily build, test, and deploy custom calculations across your workbooks without performance lags.
- 1. Download and install WPS Office: Get the free WPS Office suite from the official website and open WPS Spreadsheet.
- 2. Open your workbook: Load your existing .xlsx file or create a new document to start drafting your formulas.
- 3. Access the Formulas tab: Navigate to the Formulas tab on the top ribbon to access the built-in function library and Name Manager.
- 4. Define your custom functions: Use the Name Manager to define and store your custom formulas globally so they can be easily referenced across any sheet.

Frequently Asked Questions
Why am I getting a 'You have entered too few arguments' error in LAMBDA?
This error occurs if an optional argument is placed before a required argument in the parameter list, or if the formula attempts to evaluate the missing optional argument directly without first using the ISOMITTED function to provide a fallback calculation.
Can I have multiple optional arguments in one LAMBDA function?
Yes. You can define multiple optional arguments by placing them all in square brackets at the very end of your parameter list. You will need to use nested IF and ISOMITTED statements to handle the various combinations of missing inputs.
What does the ISOMITTED function actually do?
The ISOMITTED function checks whether a value was provided for an optional LAMBDA parameter. It returns TRUE if the argument was left blank by the user, and FALSE if a value or reference was supplied.
Does ISOMITTED work outside of LAMBDA custom functions?
No. The ISOMITTED function is specifically designed to work internally within custom LAMBDA formulas. It cannot be used to check if standard worksheet cells are empty; for that, you would use functions like ISBLANK.




