Cell attributes
Each cell in the worksheet can be blank or have some content (text, number). It can also have its own formatting elements. The CELL function allows you to read the attributes of a cell, however it is not nearly as powerful as the old GET.CELL macro function. In the following text, you will learn how to read cell attributes.
The cell attribute is read using the CELL function, whose syntax is:
CELL (<code>, <address>)
You can see the meaning of the codes in the following table:
CODE | DESCRIPTION |
address |
Default cell address (text). |
col |
Column number. |
row |
Row number. |
color |
Returns a score of 1 if the first reference cell is formatted using the color for negative number values, or 0 if it is not. |
contents |
The value of the cell. |
filename |
The path and file name. |
format |
A tag that represents the format of a number record. |
parentheses |
If negative numbers are shown in parentheses, it returns value 1, or returns 0 if they are not. |
prefix |
Text that corresponds to the cell tag prefix. |
protect |
If the cell is Locked it returns 1 and if it is not (Unlocked) returns 0. |
type |
Index indicating data type: B for empty cell, L for label, V for value. |
width |
The width of the cell. |
That is, an example of using this feature can be seen in the picture:
The GET.CELL macro function cannot be directly applied in a formula. To use it, you need to get into Name Manager (CTRL + F3), and create a new name, where we will enter the GET.CELL function as a reference, which has the same syntax as the CELL function It has many more parameters, is described in detail on Mr.Excel’s website, and you can access the text at the following link.