XLL+ Class Library (6.3)

Grouping arguments

There are two reasons why you might want or need to group a number of arguments together, so that they appear in Excel as a single argument.

Argument limit

There is a limit to how many arguments you can pass to an Excel add-in function, and a function with too many arguments will not work. In this case, you must select some of your arguments and group them, creating a scalar group or a vector group.

Under Excel 2003 and below, functions with more than 30 arguments cannot be registered, and functions with more than 20 arguments will not have descriptions in the Excel Formula Wizard. Under Excel 2007, the limit for arguments is 255. However, if you need to support both versions of Excel, you will need to follow the lower limit.

The XLL+ Function Wizard will generate a warning if there are more than 30 arguments to a function that is intended for use in the older versions of Excel.

Ease of use

The user interface may be easier to use if there are fewer arguments. For example, you may have a group of columns which are closely related, such as a column of dates and a column of payment amounts for each date. In this case, it may make sense to group the two columns as a two-dimensional array, by creating a vector group.

You can use the XLL+ Function Wizard to create groups of arguments. The wizard will generate code that splits the single Excel argument into its constituent parts, and checks that all required constituents are present and correct.

Choices

Another way you might want to group arguments is as a choice, whereby only one of the grouped arguments is expected, but it can appear in multiple different forms. See the topic Choice arguments for more information.

Next: Scalar groups >>