Excel Cell Function

This post will guide you how to use Excel CELL function with syntax and examples in Microsoft excel.

Description

The Excel CELL function returns information about the formatting, location, size, or contents of a cell.

The CELL function is a build-in function in Microsoft Excel and it is categorized as an Information Function.

The CELL function is available in Excel 2016, Excel 2013, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000, Excel 2011 for Mac.

Syntax

The syntax of the CELL function is as below:

= CELL (info_type,[reference])

Where the CELL function arguments are:
Info_type -This is a required argument. The type of information that you want to get. The following types can be used.

From Microsoft site:

info_type Returns
“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).

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“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. Returns empty text (“”) if the worksheet that contains reference has not yet been saved.

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“format” Text value corresponding to the number format of the cell. The text values for the various formats are shown in the following table. Returns “-” at the end of the text value if the cell is formatted in color for negative values. Returns “()” at the end of the text value if the cell is formatted with parentheses for positive or all values.

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“parentheses” The value 1 if the cell is formatted with parentheses for positive or all values; otherwise returns 0.

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“prefix” Text value corresponding to the “label prefix” of the cell. Returns 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, and empty text (“”) if the cell contains anything else.

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“protect” The value 0 if the cell is not locked; otherwise returns 1 if the cell is locked.

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“row” Row number of the cell in reference.
“type” Text value corresponding to the type of data in the cell. Returns “b” for blank if the cell is empty, “l” for label if the cell contains a text constant, and “v” for value if the cell contains anything else.
“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.

NOTE: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

Example

The below examples will show you how to use Excel CELL Function to retrieve information about a cell.

#1 =CELL(“row”,B1)

excel cell function example1

Note: the above excel formula will return the row number of Cell B1.

#2 =CELL(“contents”,A1)

excel cell function example2

Note: The above excel formula will return the content of cell A1.

#3 =CELL(“width”,B1)

excel cell function example3

Note: the above excel formula will return the column width of the cell B1.

More CELL Function Examples


  • Quickly Get Sheet Name
    If you want to quickly get current worksheet name only, then inert it into one cell. You can use a formula based on the MID function in combination with the FIND function and the Cell function……
  • Insert The File Path and Filename into Cell
    If you want to insert a file path and filename into a cell in your current worksheet, you can use the CELL function to create a formual……..
Related Posts

How to Get Cell Address of Max or Min Value in a Range in Excel
get cell address of max value2

This post will guide you how to return the cell address of a maximum cell value from a given range of cells with a formula in Excel. How do I Find the minimum value from a given range and return ...

How to Return Cell Address Instead of Value in Excel
return cell address intead of value1

This post will guide you how to lookup value and return cell reference containing that value in Excel. How do I return cell address from a lookup result with a formula in Excel. Return Cell Address From Lookup Result Normally, ...

Get Workbook Path Only
get workbook path3

This post will guide you how to get the current workbook path in Excel. How do I insert workbook path only into a cell with a formula in Excel. Get workbook path with Document Location You can get the workbook ...

Insert The File Path and Filename into Cell
insert filepath filename in cell5

This post will guide you how to insert the file path and filename into a cell in Excel. Or how to add a file path only in a specified cell with a formula in Excel. Or how to add the ...

Reference Tab Name
reference tab name3

This post will guide you how to reference a tab name in one cell in Excel. How do I reference a tab name in cell with a formula in Excel. Can anyone tell me the formula on displaying the name ...

Quickly Get Sheet Name
get sheet name6

This post explains that how to get the sheet name only in your current worksheet in excel. How do I insert the current worksheet's name into one cell quickly. Get Sheet Name with Formula If you want to quickly get ...

How to Get Cell Address of a Lookup Value
get cell address of lookup value 2

This post explains that how to lookup a value from a range or array, then return cell address from a lookup result in excel. How to get the cell reference of lookup result in a range. Get Cell Address (reference) ...

Get Path and Workbook name only
Get Path and Workbook name only3

Generally, the Cell function returns the full file name contain workbook and worksheet name and it is absolute path. If you want to get the workbook name and its path only without worksheet name, you can use a combination of ...

Get full File Name (workbook and worksheet) and Path
Get the Current Worksheet Name only1

In excel, you can get the current workbook name and it is absolute path using the CELL function.  Just refer to the following formula: =CELL("filename",B1) Enter the above formula into any of cells in the current worksheet, then you will ...

Get the Current Worksheet Name only
Get the Current Worksheet Name only11

If you want to get the current worksheet name only in excel, you can use a combination of the MID function, the CELL function and FIND function. You can use the below generic formula: =MID(CELL("filename",B1),FIND("]",CELL("filename",B1))+1,255) The below explains how the ...

Sidebar