CELL
Syntax:
CELL ( category [ , reference ] )
Description: Retrieves information about the formatting, location, or contents of the upper-left cell indicated by reference. category indicates the kind of information to be retrieved.
Arguments:
Name |
Type |
Description |
---|---|---|
category |
text |
The category string as defined in the table following. |
reference |
reference |
Refers to the cell whose category information is being requested. If reference is a cell range, the first cell in that range is the cell whose category information is being requested. If reference is omitted, the information retrieved pertains to the most recent cell whose value was changed. For the category |
category |
Meaning |
Result Type |
---|---|---|
"address" |
Reference of the first cell in reference. |
text |
"col" |
Column number of the cell in reference. |
number |
"color" |
1 if the cell is formatted in color for negative values; otherwise, 0. 0 if the cell does not contain a number. |
number |
"contents" |
Value of the upper-left cell in reference. |
Text or number |
"filename" |
Fully qualified filename of the file that contains reference. However, if the worksheet that contains reference has not yet been saved, the filename is an empty string. |
text |
"format" |
Number format of the cell. (See the table of formats below.) The number format string has |
text |
"parentheses" |
1 if the cell is formatted with parentheses for positive or all values; otherwise, 0. 0 if the cell does not contain a number. |
number |
"prefix" |
Text value corresponding to the label prefix of the cell, as follows:
|
text |
"protect" |
0 if the cell is not locked; otherwise, 1. |
number |
"row" |
Row number of the cell in reference. |
number |
"type" |
Text value corresponding to the type of data in the cell.
|
text |
"width" |
Column width of the cell rounded off to an integer. Each unit of column width is equal to the width of one character in the default font size. |
number |
Format |
Number Format String |
---|---|
0 |
"F0" |
0.00 |
"F2" |
#,##0 |
",0" |
#,##0.00 |
",2" |
$#,##0_);($#,##0) |
"C0" |
$#,##0_);[Red]($#,##0) |
"C0-" |
$#,##0.00_);($#,##0.00) |
"C2" |
$#,##0.00_);[Red]($#,##0.00) |
"C2-" |
0% |
"P0" |
0.00% |
"P2" |
0.00E+00 |
"S2" |
General |
"G" |
# ?/? |
"G" |
d-mmm-yy |
"D1" |
d-mmm |
"D2" |
mmm-yy |
"D3" |
m/d/yy |
"D4" |
mm/dd |
"D5" |
h:mm:ss AM/PM |
"D6" |
h:mm AM/PM |
"D7" |
h:mm:ss |
"D8" |
h:mm |
"D9" |
Return Type and Value: various (see table above) – The value corresponding to category, and whose type is shown in the category value table above.
However, if category is invalid, #VALUE!
is returned.