CELL(info_type [,reference])

Returns the text string indicating information about a cell.

info_type The text string indicating the type of information to return:
"address" = address of the cell
"col" = column number of the cell
"color" = 1 if cell format as negative font colour
"contents" = contents of the cell
"filename" = filename and full folder path of the workbook
"format" = number format of the cell
"parentheses" = 1 if the cell format as parentheses for positive values
"prefix" = label prefix of the cell
"protect" = 1 if the cell is locked, and 0 if not
"row" = row number of the cell
"type" = type of the data in the cell
"width" = column width of the cell rounded to the nearest integer
reference(Optional) The range of cells that you want information about.

Remarks

* This function is volatile and will change everytime a cell on the worksheet is calculated.
* If "info_type" = "color", then the value 1 is returned if the cell format has coloured font that has been applied for negative values.
* If "info_type" = "format", then you must recalculate this functions if the cell has a custom format applied afterwards.
* If "info_type" = "filename" and the workbook has not been saved, then a blank string is returned.
* If "info_type" = "parentheses", then the value 1 is returned if the cell format has parentheses for positive values.
* This function will update when the workbook is recalculated by pressing F9.
* The information returned is related to the contents, location or formatting of a given cell.
* If "reference" is a range of cells, then the upper left cell is used.
* If "reference" is left blank then the last cell that was changed in the active workbook is used.
* This function cannot be called from VBA, Application.WorksheetFunction.Cell does not exist.
* This function was originally provided to allow backwards compatibility with other spreadsheet programs.
* For the Microsoft documentation refer to support.office.com

 ABC
1=CELL("address",B1) = $B$15 
2=CELL("address",B1:B4) = $B$110 
3=CELL("col",B3) = 215 
4=CELL("color",B2) = 020 
5=CELL("contents",B1) = 5some text 
6=CELL("filename",C2) = C:\Temp\[Book1.xls]Sheet1  
7=CELL("format",B2) = F0  
8=CELL("parentheses",B4) = 0  
9=CELL("prefix",B5) = ' Left aligned text
10=CELL("prefix",B5) = '' Right aligned text
11=CELL("prefix",B5) = ^ Centre aligned text
12=CELL("prefix",B5) = \ Fill aligned text
13=CELL("prefix",B5) =  Blank when anything else
14=CELL("protect",B5) = 1 Cell is not locked
15=CELL("protect",B8) = 0 Cell is locked
16=CELL("row",B4) = 4  
17=CELL("type",B2) = v Value
18=CELL("type",B5) = l Label / Text
19=CELL("type",B6) = b Empty Cell
20=CELL("type",A19) = l Function
21=CELL("width",B4) = 94  
22=CELL("format",B3) = G General
23=CELL("format",B3) = F0 0
24=CELL("format",B3) = ,0 #,##0
25=CELL("format",B3) = F2 0.00
26=CELL("format",B3) = ,2 #,##0.00
27=CELL("format",B3) = C0 £#,##0_);(£#,##0)
28=CELL("format",B3) = C0- £#,##0_);[Red](£#,##0)
29=CELL("format",B3) = C2 £#,##0.00_);(£#,##0.00)
30=CELL("format",B3) = C2- £#,##0.00_);[Red](£#,##0.00)
31=CELL("format",B3) = P0 0%
32=CELL("format",B3) = P2 0.00%
33=CELL("format",B3) = S2 0.00E+00
34=CELL("format",B3) = G # ?/?
35=CELL("format",B3) = G # ??/??
36=CELL("format",B3) = D4 m/d/yy
37=CELL("format",B3) = D4 m/d/yy h:mm
38=CELL("format",B3) = D4 mm/dd/yy
39=CELL("format",B3) = D1 d-mmm-yy
40=CELL("format",B3) = D1 dd-mmm-yy
41=CELL("format",B3) = D2 d-mmm
42=CELL("format",B3) = D2 dd-mmm
43=CELL("format",B3) = D3 mm/dd/yy
44=CELL("format",B3) = D5 mm/dd
45=CELL("format",B3) = D7 h:mm AM/PM
46=CELL("format",B3) = D6 h:mm:ss AM/PM
47=CELL("format",B3) = D9 h:mm
48=CELL("format",B3) = D8 h:mm:ss


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top