Excel dynamic argument count

Add-in Express™ Support Service
That's what is more important than anything else

Excel dynamic argument count
 
Thomas Horstmann




Posts: 12
Joined: 2020-08-24
Hello,
is there a way to define Excel UDF functions with "dynamic" argument count?

Somthing like (Excel sample):

// 3 parameters
=SUM(10;20;30)

// 5 parameters
=SUM(20;30;40;50;60)
Posted 28 Aug, 2020 01:40:14 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Thomas,

Excel doesn't support this.

The user is able to provide only certain arguments to a function. Accordingly, you should be prepared to this.


Andrei Smolin
Add-in Express Team Leader
Posted 28 Aug, 2020 03:50:50 Top
Thomas Horstmann




Posts: 12
Joined: 2020-08-24
Maybe "dynamic" is the wrong wording. Is it possible to make a parameter "optional" with a default value. Like Excel sum function.
Posted 29 Aug, 2020 04:57:12 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

It is possible to make a parameter optional, you can do this in the Type Library editor. I have created a small demo project for you:
https://www.add-in-express.com/projects/delphi/adxXLFunction-Delphi.zip

As for default values, the Type Library editor allows adding default values for parameters, but I have never tested this.
Posted 01 Sep, 2020 03:02:23 Top