Table Formulas
Table formula codes and their operation are shown below. These codes are used by New Cell
Formula (function 0xD0 subfunction 0x81) and Floating Cell Begin (function 0xD4 subfunction
0x44) in Variable-Length Multi-Byte Functions. Values are shown in decimal. All string lengths
are 16-bit values. All strings are WP word strings, except code 30, which is a byte string. The
expression "cell#" denotes "row, column" where row and column are each signed 16-bit numbers.
Formula Format
Formula Code | Description | Length |
[1] | "+" add/concatenate | 1 byte |
[2] | "-" subtract/string strip | 1 byte |
[3] | "*" multiply | 1 byte |
[4] | "/" divide | 1 byte |
[5] | "-" unary minus | 1 byte |
[6] | "%" percent | 1 byte |
[7] | SUM() | 1 byte |
[8,string w/length] | number constant | 1 byte + string |
[9,string w/length] | string constant | 1 byte + string |
[10,string w/length] | name reference | 1 byte + string |
[11] | "^" power | 1 byte |
[12,function#] | group 1 functions | 2 bytes |
[13,function#] | group 2 functions | 2 bytes |
[14,dir,cnt,type,27,cell#] | "+" shortcut code | 9 bytes |
[15] | "%" modulus | 1 byte |
[16] | "!" not | 1 byte |
[17] | "&" and | 1 byte |
[18] | "|" or | 1 byte |
[19] | "^^" xor | 1 byte |
[20] | IF () | 1 byte |
[21,function#] | compare | 2 bytes |
[21,1] | "=" equal | |
[21,2] | "<>" not equal | |
[21,3] | ">" greater than | |
[21,4] | ">=" greater than or
equal | |
[21,5] | "<" less than | |
[21,6] | "<=" less than or
equal | |
[22] | "," comma | 1 byte |
[23] | "(" left parenthesis | 1 byte |
[24] | ")" right parenthesis | 1 byte |
[25,space#] | space(s) | 2 bytes |
[26,string w/length] | formula error | 1 byte + string |
not used[27,cell#] | cell reference | 5 bytes |
not used[28,cell#,cell#] | range reference | 9 bytes |
[29] | "!=" not equal | 1 byte |
[30,fp,byte string w/len] | floating point constant | 9 bytes + string |
[31,argument number] | user argument reference | 2 bytes |
[32,string w/length] | user function call | 1 byte + string |
[33,temp#,string w/length] | temp function definition | 2 bytes + string |
[34,temp#,string w/length] | temp function | 2 bytes + string |
[35] | floating point constant 0.0 | 1 byte |
[36] | "{" left brace | 1 byte |
[37] | "}" right brace | 1 byte |
[38] | "!" factorial | 1 byte |
[39] | "<" lookup operator | 1 byte |
[40] | ">" lookup operator | 1 byte |
[41,WP attribute#] | attribute on | 2 bytes |
[42,WP attribute#] | attribute off | 2 bytes |
[43,WP attribute mask] | total attribute mask | 3 bytes |
[44] | conditional attribute | 1 byte |
[45] | * (assumed) | 1 byte |
For codes 48..67:
bit 0 set if absolute col (bottom-right cell if range) bit 1 set if absolute row (bottom-right cell if range) bit 2 set if absolute col (top-left cell in range) bit 3 set if absolute row (top-left cell in range) | ||
[48-63,cell#,cell#] | range reference | 9 bytes |
[64-67,cell#] | cell reference | 5 bytes |
Function Number Values for Code 12 | |||||
1 | MINUS | 8 | AND | 15 | ISNA |
2 | ABS | 9 | OR | 16 | TIME |
3 | INT | 10 | AVE | 17 | DATE |
4 | SIGN | 11 | COUNT | 18 | FACT |
5 | NOT | 12 | MIN | 19 | ROW |
6 | TRUE | 13 | MAX | 20 | COLUMN |
7 | FALSE | 14 | NA |
Function Number Values for Code 13 | |||||
1 | POWER | 28 | MDY | 55 | BLOCK |
2 | LN | 29 | MONTH | 56 | CURSOR |
3 | LOG | 30 | DAY | 57 | DDB |
4 | SQRT | 31 | YEAR | 58 | SLN |
5 | PI | 32 | DATETEXT | 59 | SYD |
6 | EXP | 33 | DATEVALUE | 60 | RATE |
7 | SIN | 34 | VAR | 61 | STATUS |
8 | COS | 35 | RANDOM | 62 | FOREACH |
9 | TAN | 36 | CURRENCY | 63 | DEGREES |
10 | MOD | 37 | ITERATION | 64 | HOUR |
11 | ASIN | 38 | ISVALUE | 65 | MINUTE |
12 | ACOS | 39 | ISTEXT | 66 | SECOND |
13 | ATAN | 40 | REPLACE | 67 | HMS |
14 | TERM | 41 | RADIANS | 68 | TIMETEXT |
15 | PV | 42 | CELL | 69 | TIMEVALUE |
16 | PMT | 43 | SUBTRACT | 70 | PRODUCT |
17 | FV | 44 | IRR | 71 | QUOTIENT |
18 | NPV | 45 | FIND | 72 | VARP |
19 | LOOKUP | 46 | LEFT | 73 | STDEVP |
20 | INDEX | 47 | RIGHT | 74 | ATAN2 |
21 | ROUND | 48 | UPPER | 75 | MATCH |
22 | STDEV | 49 | LOWER | 76 | MATCH2 |
23 | CONCEDE | 50 | PROPER | 77 | LOOKUP2 |
24 | MID | 51 | CHAR | 78 | LINK |
25 | LENGTH | 52 | CODE | 79 | ISERR |
26 | VALUE | 53 | TRIM | 80 | ISERR2 |
27 | TEXT | 54 | REPEAT | 81 | CHOOSE |
Order of Operator Execution
Operator | Associativity | Level |
! (factorial), % (percent) | left to right | immediate |
! (not), - (negate) | right to left | 16 |
^ | left to right | 15 |
*, /, % (modulus) | left to right | 14 |
+, - (subtract) | left to right | 13 |
<<, >> | left to right | 12 (n/a) |
<, <=, >, >= | left to right | 11 |
=, <> (or !=) | left to right | 10 |
&& (or &) | left to right | 9 |
^^ | left to right | 8 |
|| (or |) | left to right | 7 |
?; | right to left | 6 (n/a) |
:= | right to left | 5 |
() | left to right | 4 |
, | left to right | 3 |