Document on functions

# Document on functions - =tax(C7, rate) where...

This preview shows pages 1–2. Sign up to view the full content.

Function Basics Function Parts (and an example of each) Function Name: tax Input variables and type of each: (taxableAmount is money, taxRate is decimal) Output data type: money Function Calculations/Manipulations: tax = taxableAmount * taxRate So…… tax is a function of taxableAmount and taxRate and returns a money type value. To use a function, you must specify its name and provide a value for each input. The input values must be listed in the same order as listed in the function details, and separated by a comma. Below are some examples of a "call" to a function. The function "returns" its value to the environment from which it was cell, for example, a particular worksheet cell. =tax(25.00, .06) where 25.00 is the taxableAmount and .06 is the taxRate =tax(C7, \$D\$2) where C7 contains the taxableAmount and \$D\$2 contains the taxRate

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: =tax(C7, rate) where "rate" is a named range Function Details Example 1: Begin Function tax (taxableAmount is money, taxRate is decimal) returns money tax = taxableAmount * taxRate End Function Example 2: Begin Function tax2 (taxableAmount is money, taxRate is decimal, taxable is Boolean) returns money If taxable = TRUE then tax2 = taxableAmount * taxRate Else tax2 = 0 End If End Function Example 3: Begin Function tax3 (taxableAmount is money, stateRate is decimal, cityRate is decimal, taxable is Boolean, inCity is Boolean) returns money If taxable = TRUE then tax3 = taxableAmount * stateRate If inCity = TRUE then tax3 = tax + taxableAmount * cityRate End If Else tax3 = 0 End If End Function...
View Full Document

## This note was uploaded on 08/15/2011 for the course ACIS 2504 at Virginia Tech.

### Page1 / 2

Document on functions - =tax(C7, rate) where...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online