CellSpace/Manual (draft)
by CellWorks
Home
  
Table of Contents
  
Glossary
Functions
Functions
are used within formulas, or other
Functions
to calculate a value. There are two types of
Functions
:
  • Built-in
    Functions
    . See .
  • User defined
    Functions
    . See the
    New
    -->
    Add
    Function
    to '
    Folder
    '
    menu item.
User defined functions are a maintainable alternative to repeated fill operations.
  • For example, a user defined function called MyPV with the , (rate, nper, pmt, fv, type) is defined as:
  • 	if (rate = 0) {
    	    return -fv - (pmt * nper)
    	}
    	var result
    	result = ((1 + rate) ^ nper) - 1
    	result = result / rate
    	result = result * pmt
    	result = result * -(1 + rate * type)
    	result = result - fv
    	result = result / ((1 + rate) ^ nper)
    	return result
  • Note that is also defined as a built-in function.
  • For example, a user defined function the sums the total deposits, with one called (allTransactions) is written as:
  • 	var total = 0
    	for (var transaction : allTransactions) {
    	    if (!IsError(transaction) && !IsBlank(transaction) && transaction > 0) {
    	        total = total + transaction
    	    }
    	}
    	return total
  • Note that can be passed as arguments to user defined functions.