[Table of Contents] [docx version]
SpreadsheetML Reference Material - Table of Contents
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 |
The category string as defined in the table following. | |
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 "format", if reference designates a cell formatted with a built-in number format, the number format string is as defined in the table following. |
category |
Meaning |
Result Type |
"address" | ||
"col" |
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" |
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. | |
"format" |
Number format of the cell. (See the table of formats below.) The number format string has "-" appended if the cell is formatted in color for negative values. The number format string has "()" appended if the cell is formatted in color for positive or all values. | |
"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: • Single quotation mark (') if the cell contains left-aligned text • Double quotation mark (") if the cell contains right-aligned text • Caret (^) if the cell contains centered text • Backslash (\) if the cell contains fill-aligned text • Empty string if the cell contains anything else | |
"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. • "b" (blank) if the cell is empty • "l" (label) if the cell contains a text constant | |
"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" |
"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.
[Example:
CELL("address",A10) might result in $E$289
CELL("contents",A10:B10), results in xxx, when A10 contains xxx, and B10 contains anything
CELL("filename",A10) might result in E:\Formulas\[Test.xlsx]Sheet1
CELL("format",A10) results in G, when A10 contains xxx
CELL("format",A10) results in F2-, when A10 contains (123.00)
CELL("format",A10) results in C3-, when A10 contains $123,456.780
CELL("format",A10) results in S3, when A10 contains 1.235E+05
CELL("prefix",A10) results in ', when A10 contains xxx
CELL("type",A10) results in l, when A10 contains xxx
end example]