ARG Function

Specifies an argument that the calling cell can pass to a custom function, as well as the default value returned by the custom function if the calling cell does not pass in a value for the argument. Returns the value specified by the calling cell and the matching argName parameter.

Syntax

ARG(argName,[ defaultValue ])

Parameters

Name Required/Optional Data Type Description
argName
Required
String
The name of an argument that the calling cell can pass into the function.
default Value
Optional
Numeric
The value returned by ARG if the calling cell did not pass in a value for the argName parameter.

Remarks

As a shape developer, you can create custom functions by placing an expression in one cell and calling that expression from one or more other cells. The expression can include literal strings, ShapeSheet functions, and cell references. The expression can also include specific arguments that are passed in by the calling cell.

The calling cell specifies the cell that contains the custom function as well as any arguments that it wants to pass to the function. The expression cell is evaluated and the result returned to the calling cell.

Example

The following example shows how to use the ARG function in conjunction with the EVALCELL function to find the middle value from a set of three values.

In the expression cell, place the following code that defines the custom function:

User.MiddleValue = IF(ARG("A")>ARG("B"),IF(ARG("B")>ARG("C"),ARG("B"),IF(ARG("A")>ARG("C"),ARG("C"),ARG("A"))),IF(ARG("A")>ARG("C"),ARG("A"),IF(ARG("B")>ARG("C"),ARG("C"),ARG("B"))))

In the calling cells, place the following code that calls the custom function:

User.Middle1 = EVALCELL(User.MiddleValue,"A",3,"B",9,"C",5) 
User.Middle2 = EVALCELL(User.MiddleValue,"A",12,"B",0,"C",21)