EVALCELL Function

Office 2013 and later

Last modified: March 09, 2015

Applies to: Office 2013 | Visio 2013

In this article
Syntax
Remarks
Example

Takes a reference to a cell that contains a custom function as well as one or more name-value pairs to pass to the custom function as arguments (optional). Returns the calculated result of the custom function given the specified arguments and values.

EVALCELL(cellRef,[arg1Name,arg1],[arg2Name,arg2],…)

Parameters

Name

Required/Optional

Data Type

Description

cellRef

Required

String

A reference to the cell that contains the custom function. Cross-sheet references are allowed.

arg1Name

Optional

String

The name of the first argument to be passed to the custom function. Spaces are allowed.

arg1

Optional

Varies

Value of the arg1 parameter.

arg2Name

Optional

String

The name of the second argument to be passed to the custom function. Spaces are allowed.

arg2

Optional

Varies

Value of the arg2 parameter.

Return Value

Number

The calling cell does not have to specify every argument used by the custom function.

The following example shows how to use the EVALCELL function in conjunction with the ARG 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) 

Show: