Advanced-excel-functions-advanced-excel-information-cell-function
高度なExcel情報-CELL機能
説明
CELL関数は、セルの書式設定、場所、またはコンテンツに関する情報を返します。
構文
引数
Argument | Description | Required/Optional |
---|---|---|
Info_type |
A text value that specifies what type of cell information you want to return. Info_typeの可能な値は、以下の表Info_type値に示されています。 |
Required |
Reference |
The cell that you want information about. 省略した場合、Info_type引数で指定された情報は、変更された最後のセルに対して返されます。 参照引数がセルの範囲である場合、CELL関数は範囲の左上のセルのみの情報を返します。 |
Optional |
Info_type値
Info_type | Type of cell information to return |
---|---|
"address" | Reference of the first cell in reference, as text. |
"col" | Column number of the cell in reference. |
"color" | The value 1 if the cell is formatted in color for negative values. Otherwise returns 0 (zero). |
"contents" | Value of the upper-left cell in reference. Not a formula. |
"filename" |
Filename (including full path) of the file that contains reference, as text. 参照を含むワークシートがまだ保存されていない場合、空のテキスト( "")を返します。 |
"format" |
Text value corresponding to the number format of the cell. さまざまな形式のテキスト値は、以下の表CELL形式コードに示されています。 セルが負の値の色でフォーマットされている場合、テキスト値の末尾に「-」を返します。 セルが正の値またはすべての値の括弧でフォーマットされている場合、テキスト値の末尾に「()」を返します。 後で参照セルに別の形式を適用する場合、ワークシートを再計算して、CELL関数の結果を更新する必要があります。 |
"parentheses" |
The value 1 if the cell is formatted with parentheses for positive or all values. それ以外の場合は0を返します。 |
"prefix" |
Text value corresponding to the "label prefix" of the cell. Returns
|
"protect" |
The value 0 if the cell is not locked. それ以外の場合、1を返します(セルがロックされている場合)。 |
"row" | Row number of the cell in reference. |
"type" |
Text value corresponding to the type of data in the cell.
|
"width" |
Column width of the cell, rounded off to an integer. 列幅の各単位は、デフォルトのフォントサイズの1文字の幅に等しくなります。 |
CELLフォーマットコード
次の表は、Info_type引数が「format」で、参照引数が組み込みの数値形式でフォーマットされたセルである場合にCELL関数が返すテキスト値を示しています。
Excel Format of the Cell | What CELL Function returns |
---|---|
General | "G" |
0 | "F0" |
,#0 | ",0" |
0.00 | "F2" |
,#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" |
# ?/? or # ??/?? | "G" |
m/d/yy or m/d/yy h:mm or mm/dd/yy | "D4" |
d-mmm-yy or dd-mmm-yy | "D1" |
d-mmm or dd-mmm | "D2" |
mmm-yy | "D3" |
mm/dd | "D5" |
h:mm AM/PM | "D7" |
h:mm:ss AM/PM | "D6" |
h:mm | "D9" |
h:mm:ss | "D8" |
ノート
info_typeが上記の認識されたタイプのいずれでもない場合、CELL関数は#VALUE!を返します。 エラー。
適用範囲
Excel 2007、Excel 2010、Excel 2013、Excel 2016