home *** CD-ROM | disk | FTP | other *** search
/ Big Blue Disk 43 / bbd43.zip / PCFUNCTS.TXT < prev    next >
Text File  |  1990-03-19  |  17KB  |  386 lines

  1. |A╔═══════════════╗══════════════════════════════════════════════╔═══════════════╗
  2. |A║ |6Personal Calc|A ║════════════ ^1Function Documentation |A══════════║ |6Personal Calc|A ║
  3. |A╚═══════════════╝══════════════════════════════════════════════╚═══════════════╝
  4. ^Cby
  5. ^CDoug Harrison
  6.  
  7.  Function reference 
  8.  ================== 
  9.  PC supports multiple arguments for the statistical functions; the term "expr 
  10.  list" means that you may use up to 20 values, cell references, and range 
  11.  references as function arguments.  Although some functions, such as NA(), 
  12.  require no arguments, the parentheses are required. 
  13.  
  14.  Arithmetic 
  15.  ----------
  16.  DIV(numerator, denominator), MOD(numerator, denominator) 
  17.  These are division and modulus functions that satisfy the equation below (for 
  18.  both real and integer values): 
  19.  
  20.  x = DIV(x,y)*y+MOD(x,y) 
  21.  
  22.  ABS(expr) 
  23.  Returns the absolute value of expr. 
  24.  
  25.  Power 
  26.  -----
  27.  LN(expr)                           natural logarithm (base e) 
  28.  LOG(expr)                          log base 10 
  29.  EXP(expr)                          e raised to a power 
  30.  POW(expr1,expr2)                   expr1 raised to expr2 power 
  31.  SQR(expr)                          square 
  32.  SQRT(expr)                         square root 
  33.  
  34.  Trig 
  35.  ----
  36.  All the trig functions (except RAD) expect angles to be specified in radians, 
  37.   and the inverse trig functions return a radian value. 
  38.  
  39.  SIN, COS, TAN(angle)               sine, cosine, tangent 
  40.  ASIN, ACOS, ATAN(expr)             inverse functions 
  41.  ATAN2(x-expr,y-expr)               four-quadrant arctangent 
  42.  RAD(angle in degrees)              returns angle in radians 
  43.  DEG(angle in radians)              returns angle in degrees 
  44.  PI()                               returns pi 
  45.  
  46.  Logical 
  47.  -------
  48.  =, <>, <, <=, >, >= 
  49.  Logical operators return 1 to indicate TRUE and 0 to indicate FALSE.  For 
  50.   example, the value of 2 <> 3 is 1, while 2 > 3 evaluates to 0. 
  51.  
  52.  IF(condition, action, alternate action) 
  53.  The three IF parameters may be any valid expression, including nested IFs.  IF 
  54.  returns the value of "action" when condition evaluates to non-zero, and it 
  55.  returns "alternate action" when condition evaluates to zero. 
  56.  
  57.  AND(expr1, expr2, expr3, ...) 
  58.  Returns 1 if all parameters are non-zero, and 0 if any evaluate to zero.  Both 
  59.  AND and OR require at least two parameters. 
  60.  
  61.  OR(expr1, expr2, expr3, ...) 
  62.  Returns 1 if any parameter is non-zero, and 0 only if all evaluate to zero.  
  63.  Both AND and OR require at least two parameters. 
  64.  
  65.  NOT(expr) 
  66.  Returns 1 if expr evaluates to zero, and 0 if expr evaluates to non-zero. 
  67.  
  68.  TRUE() 
  69.  Returns 1. 
  70.  
  71.  FALSE() 
  72.  Returns 0. 
  73.  
  74.  Statistical 
  75.  -----------
  76.  SUM(expr list) 
  77.  Computes sum of all values within expr list.  Empty cells and labels are 
  78.  considered to have value 0. 
  79.  
  80.  PROD(expr list) 
  81.  Computes product of all values within expr list.  Empty cells and labels are 
  82.  considered to equal 1.  Should the range contain no values, PROD returns 0. 
  83.  
  84.  MEAN(expr list) 
  85.  Computes the mean or average of all values within expr list.  Empty cells and 
  86.  labels aren't considered. 
  87.  
  88.  MEDIAN(expr list) 
  89.  Computes the median of all values within expr list, ignoring labels and empty 
  90.  cells.  The median is defined for sets of values containing three or more 
  91.  members.  Median works by creating a temporary array which it then sorts; each 
  92.  value requires eight bytes in this temporary array.  Thus, to compute the 
  93.  median of 1,000 values, you must have 8,000 bytes of free RAM as indicated 
  94.  under Statistics.  Note:  this RAM is allocated and returned to the system as 
  95.  MEDIAN is computed; although calculating the median requires some free memory, 
  96.  the MEDIAN function itself requires no more RAM than any other function. 
  97.  
  98.  VAR(expr list) 
  99.  Computes the sample variance for expr list, ignoring empty cells and labels. 
  100.  
  101.  VARP(expr list) 
  102.  Computes the population variance for expr list, ignoring empty cells and 
  103.  labels. 
  104.  
  105.  SDEV(expr list) 
  106.  Computes the sample standard deviation for expr list, ignoring empty cells and 
  107.  labels. 
  108.  
  109.  SDEVP(expr list) 
  110.  Computes the population standard deviation for expr list, ignoring empty cells 
  111.  and labels. 
  112.  
  113.  SERR(expr list) 
  114.  Computes the standard deviation of the mean (the standard error) for expr 
  115.  list, ignoring empty cells and labels. 
  116.  
  117.  MAX, MIN(expr list) 
  118.  Return the maximum and minimum values within the expr list. 
  119.  
  120.  COUNT(expr list) 
  121.  Returns the number of cells containing values within expr list. 
  122.  
  123.  RAND(lower bound, upper bound) 
  124.  Returns a random number between the given lower and upper bounds.  
  125.  Note: There is no restriction on the difference between the bounds, except 
  126.  that the upper bound must be greater than the lower.  Keep in mind that PC's 
  127.  RAND function has a range of 32,767.  This means that there are a maximum of 
  128.  32,767 discrete values within any range, whether it be 1E-20 to 1.0001E-20 or 
  129.  1 to 1E30.  Actually, due to limitations of binary floating point 
  130.  representation, there may be fewer discrete values within a given range. 
  131.  
  132.  Financial 
  133.  ---------
  134.  PC follows a convention that involves breaking down monetary values into cash 
  135.  inflows (like income), which are expressed as positive numbers, and cash 
  136.  outflows (like expense), expressed as negative numbers.  For example, the PMT 
  137.  function will normally return a negative value, as you are paying out funds. 
  138.  
  139.  The "type" argument appears in all the financial functions, and if equal to 1, 
  140.  it indicates payments occur at the ends of periods (ordinary annuities).  If 
  141.  type equals 0, payments are assumed to occur at the beginning of periods 
  142.  (annuities due).  Note that for some combinations of arguments, namely those 
  143.  implying a simple or compound interest calculation, the type field will be 
  144.  meaningless; nevertheless, it is required as a place-holder. 
  145.  
  146.  The number of compounding periods should be whatever is most appropriate; for 
  147.  example, you would use 365*n for daily compounding over n years.  The rate 
  148.  arguments refer to the interest rate per compounding period, so for monthly 
  149.  compounding over 1 year at 12% interest, rate would equal 12%/12, or 1%, while 
  150.  # periods would equal 12. 
  151.  
  152.  PV(rate, # periods, payment, future value, type) 
  153.  Computes present value. 
  154.  
  155.  FV(rate, # periods, payment, present value, type) 
  156.  Computes future value. 
  157.  
  158.  NPER(rate, payment, present value, future value, type) 
  159.  Calculates number of periods. 
  160.  
  161.  PMT(rate, # periods, present value, future value, type) 
  162.  Calculates payment. 
  163.  
  164.  RATE(#periods, payment, present value, future value, type, guess) 
  165.  Computes interest rate.  RATE uses an iterative method (Newton's) to find 
  166.  rate; it requires a "guess value" to seed the process, and you should try 
  167.  using a value less than what you expect RATE to return.  (Good starting points 
  168.  for guess are values like 0.01, 0.001, etc.) RATE returns an error if it can't 
  169.  find a reasonably accurate solution within 20 iterations. 
  170.  
  171.  The financial functions are based on the following equation, and RATE 
  172.  successfully returns a value if it finds an interest rate that satisfies the 
  173.  following equation to an accuracy of 1E-8: 
  174.  
  175.  0 = PV+(1+(i%*S)/100)*PMT*USPV+FV*SPPV. 
  176.  
  177.  S is the payment mode (0 for end mode, 1 for begin mode).  Note this is the 
  178.  opposite of what the functions expect as an argument (the value 1 seemed more 
  179.  logical than 0 to indicate a date later in the period).  
  180.  i% = periodic interest rate 
  181.  n = number of compounding periods 
  182.  SPPV = (1+i%/100)^-n 
  183.  USPV = (1-(1+i%/100)^-n)/(i%/100) 
  184.  
  185.  Lookup 
  186.  ------
  187.  INDEX(row index, column index, range) 
  188.  INDEX returns the value of a cell within range, located by row index and 
  189.  column index, which must be numbers greater than or equal to one.  These 
  190.  numbers are offsets into the range, with the upper-left corner of the range 
  191.  having 1,1 for its indices.  For example, INDEX(1,1,A1:B5) returns the value 
  192.  of A1, while INDEX(3,2,A1:B5) returns the value of B3 (row 3 and column 2 
  193.  within the range A1:B5). 
  194.  
  195.  VLOOKUP(lookup value, column index, range) 
  196.  VLOOKUP searches down the leftmost column (which should be sorted in ascending 
  197.  order) of the indicated range to find the greatest value which is less than or 
  198.  equal to the lookup value; it uses this row number as a row index, along with 
  199.  the column index supplied in the function, then returns the value of the cell 
  200.  pointed to by these two indices.  VLOOKUP is like INDEX, except it determines 
  201.  the row index based on the lookup value, while you still provide the column 
  202.  index and the range.   An error occurs if no match is found or the index 
  203.  references a column outside the range. 
  204.  
  205.  HLOOKUP(lookup value, row index, range) 
  206.  HLOOKUP searches across the top row (which should be sorted in ascending 
  207.  order) of the indicated range to find the greatest value which is less than or 
  208.  equal to the lookup value; it uses this column number as a column index, along 
  209.  with the row index supplied in the function, then returns the value of the 
  210.  cell pointed to by these two indices.  HLOOKUP is like INDEX, except it 
  211.  determines the column index based on the lookup value, while you still provide 
  212.  the row index and the range.   An error occurs if no match is found or the 
  213.  index references a row outside the range. 
  214.  
  215.  CHOOSE(index, expr 1, expr 2, ...) 
  216.  CHOOSE allows you to store a list of values in a single cell, and it retrieves 
  217.  the value at the position indicated by index.  For example, an index of 2 
  218.  returns the value of the second expression in the list. 
  219.  
  220.  LOOKUP(lookup value, lookup range, results range) 
  221.  LOOKUP searches the lookup range for the greatest value less than or equal to 
  222.  the lookup value.  It notes the row and column indices of this value within 
  223.  the lookup range and returns the value in the results range having the same 
  224.  indices.  The values within the lookup range should be arranged in ascending 
  225.  order for LOOKUP to function properly, and the two ranges must contain the 
  226.  same number of cells.  If you specify a two-dimensional range for LOOKUP, the 
  227.  range is scanned by rows. 
  228.  
  229.  MATCH(lookup value, range, type) 
  230.  MATCH returns the position of the lookup value within the indicated range.  
  231.  The type argument determines the search criteria.  When type is 1, MATCH 
  232.  searches for the greatest value less than or equal to the lookup value.  When 
  233.  type is 0, MATCH searches for an exact match.  Finally, when type is -1, MATCH 
  234.  looks for the smallest value greater than or equal to the lookup value.  For 
  235.  this function to operate properly, when type is 0 or 1, the values must be 
  236.  arranged in ascending order.  When type is -1, they must be in descending 
  237.  order.  If you specify a two-dimensional range for MATCH, the range is scanned 
  238.  by rows. 
  239.  
  240.  Note:  LOOKUP, MATCH, HLOOKUP, and VLOOKUP all search a range to perform their 
  241.  function, and all depend on the range being sorted a certain way, as described 
  242.  above.  A logical question concerning the search criteria is, "how do they 
  243.  deal with a run of equal values, if this value ultimately matches the search?" 
  244.  In this case, they all proceed to the last value within the run of equal 
  245.  values. 
  246.  
  247.  Date/Time 
  248.  ---------
  249.  DATE(year, month, day) 
  250.  DATE computes the proper serial date value from the supplied arguments.  Year 
  251.  should be specified as the number of years from 1900, month should be a number 
  252.  between 1 and 12, and day should be between 1 and the last day of month.  
  253.  Except for the year, these rules are not immutable; for example, DATE(89,2,29) 
  254.  returns a serial date value corresponding to March 1, 1989, since 1989 isn't a 
  255.  leap year.  DATE returns a value with a fractional portion equal to zero; in 
  256.  other words, all DATE values are set at 12 Midnight of the indicated day. 
  257.  
  258.  YEAR(expr) 
  259.  Returns the year (1900-26541) of a given serial date value. 
  260.  
  261.  MONTH(expr) 
  262.  Returns the month (1-12) of the serial date value. 
  263.  
  264.  DAY(expr) 
  265.  Returns the day of the month of the serial date value. 
  266.  
  267.  WEEKDAY(expr) 
  268.  Returns the day of the week of the given serial date value, where Sunday is 1, 
  269.  Monday is 2, etc. 
  270.  
  271.  ISLEAP(expr) 
  272.  Returns one if the value is a leap year and zero otherwise.  In contrast to 
  273.  DATE, here the value should be specified as years A.D. 
  274.  
  275.  DAYSMONTH(month, year) 
  276.  Returns the number of days in a given month within a given year.  The year 
  277.  should be specified as years A.D. 
  278.  
  279.  TIME(hours, minutes, seconds) 
  280.  Returns a serial date value with integer portion 0 representing the indicated 
  281.  time.  Hours should be expressed using the military convention, (the 0-23 
  282.  scale).  Minutes and seconds range from 0-59.  As with the DATE function, 
  283.  these rules are flexible. 
  284.  
  285.  HOUR(expr) 
  286.  Returns the hour of a serial date value in military notation (0-23). 
  287.  
  288.  MINUTE(expr) 
  289.  Returns the minute (0-59) of a serial date value. 
  290.  
  291.  SECOND(expr) 
  292.  Returns the seconds (0-59) of a serial date value. 
  293.  
  294.  NOW() 
  295.  Returns a serial date value representing the current date and time, as read 
  296.  from the PC's clock.  One date format, "m/d/yy, h:ii", is designed to display 
  297.  this function's result. 
  298.  
  299.  Date/Time Arithmetic 
  300.  --------------------
  301.  PC provides a full set of date and time functions.  Dates are represented as 
  302.  integers equalling the number of days from PC's "day 0," while time is 
  303.  expressed as a fraction of a day (24 hours).  The smallest valid date value is 
  304.  0, corresponding to 12 Midnight, Dec.  30, 1899, while the largest supported 
  305.  value is for all intents and purposes, unlimited.  Since dates are represented 
  306.  by integers and time by fractions, dates and times may be combined into a real 
  307.  number representing both.  For example, 12 Noon on May 3, 1989 would have 
  308.  value 32631.5. 
  309.  
  310.  Since date and time are numbers, they may be operated on just as any other 
  311.  number.  It is up to you to determine what operations make sense; for example, 
  312.  adding one date to another is not usually meaningful, but PC will allow it.  
  313.  However, PC can easily calculate the number of days between two dates by using 
  314.  something like DATE(89,5,3)-DATE(89,3,2).  Adding integers to date values may 
  315.  also be useful in creating a series of dates, but you may find it more 
  316.  convenient to use PC's Date Fill commands.  
  317.  
  318.  You may also find a use for combined date/time numbers.  For example, you 
  319.  could create a formula DATE(89,5,5)+TIME(18,0,0), and the result would be a 
  320.  serial date value representing 6 PM, May 5, 1989.  Adding 0.5 (12 hours) to 
  321.  this would result in a number corresponding to 6 AM, May 6, 1989. 
  322.  
  323.  Cell 
  324.  ----
  325.  ROW, COLUMN(cell ref) 
  326.  Return the row and column number of the argument. 
  327.  
  328.  Range 
  329.  -----
  330.  ROWS, COLUMNS(range) 
  331.  Return the number of rows or columns in the range supplied. 
  332.  
  333.  Miscellaneous 
  334.  -------------
  335.  ISERR(expr list) 
  336.  ISERR() returns 1 if any expression within the list generate an error and 0 
  337.  otherwise.  It could be used in a conditional such as:  
  338.  
  339.  =IF(ISERR(A1/A2),A3,A4).  
  340.  
  341.  ISERR() does not check for the NA error condition. 
  342.  
  343.  ISNA(expr list) 
  344.  ISNA() is similar to ISERR(), except that it tests specifically for the NA 
  345.  error status.  These two functions allow PC's extended error reporting to 
  346.  coexist peacefully with Lotus 123 files; 123 supports two error conditions, 
  347.  ERR and NA. 
  348.  
  349.  ISEMPTY(list of cells or ranges) 
  350.  ISEMPTY determines if any cell or range out of a supplied list contains a 
  351.  value; it returns 1 if no values are encountered and 0 if a value is detected. 
  352.  
  353.  ERROR() 
  354.  ERROR() is a function that forces the ERR error condition.  For example, it 
  355.  might be used as in the following way:  
  356.  
  357.  =IF(ISEMPTY(A1),ERROR(),A2). 
  358.  
  359.  NA() 
  360.  Similar to ERROR(), NA() forces the NA error status. 
  361.  
  362.  ROUND, TRUNC(expr, place) 
  363.  These functions take an expression and either round or truncate it to the 
  364.  value specified by "place."  Place may be positive, negative or zero.  
  365.  Consider the number 126.556, supplied to ROUND and TRUNC, for the following 
  366.  values of place: 
  367.  
  368.  expr = 126.556 
  369.  
  370.  Place         ROUND          TRUNC 
  371.    2            126.56         126.55 
  372.    1            126.6          126.5 
  373.    0            127            126 
  374.   -1            130            120 
  375.   -2            100            100 
  376.   -3              0              0 
  377.  
  378.  As you can see, you can round or truncate within the whole number portion of 
  379.  the expression, as well as within the fractional portion. 
  380.  
  381.  INT, FRAC(expr) 
  382.  Return the integer and fractional parts of a number, such that INT(X)+FRAC(X) 
  383.  = X.  Negative numbers are handled as follows:  INT(-3.4) = -3, FRAC(-3.4) = -
  384.  0.4. 
  385.  
  386.