How to Use CELL Function in Excel [4 Examples]

In the realm of Excel functions, the CELL function stands out as a versatile tool for obtaining information about cell formatting, location, and content. In this article, we delve into the intricacies of the CELL function, exploring its syntax, arguments, and output type, and providing practical examples to illustrate its utility.

What Does the Excel CELL Function Do?

The CELL function in Excel retrieves information about the formatting, location, or contents of a cell. You can use it to extract details such as the cell address, format, filename, sheet name, and more. Essentially, it provides a convenient means to gather specific information about any given cell within a worksheet.

What is the Syntax of the Excel CELL Function?

The syntax of the CELL function is as follows:

=CELL(info_type, [reference])

Here, the info_type represents the type of information you want to retrieve, and the reference is an optional parameter that specifies the cell you’re interested in obtaining information for. If you leave out a reference, the function defaults to the cell where you enter it.

What Are the Arguments of the Excel CELL Function?

The Excel CELL function accepts two arguments. The first argument, info_type, specifies the type of information to be returned by the function. This argument can take various values, including “address” to retrieve the cell address, “filename” to obtain the full path and filename of the Excel workbook, “color” to retrieve the color index of the cell, “contents” to get the contents of the cell, and “format” to obtain the number format of the cell, among others. The second argument, reference, is optional and specifies the cell for which information is to be retrieved. If you leave it out, the CELL function defaults to referring to the cell where you entered it.

What is the Output Type of the Excel CELL Function?

The output type of the CELL function varies based on the info_type specified. It can return text, numerical values, or error messages, depending on the nature of the requested information.

4 Examples of Using CELL Function in Excel

Example 1: Retrieving Cell Address

Suppose we have data in cell A2, and we want to display its address. We can use the following formula:

=CELL("address", A2)

This will return “$A$2“, indicating the address of cell A2.

Example 2: Extracting File Name

To retrieve the filename of the current workbook, we can use:


This will display the full path and filename of the Excel file.

Example 3: Obtaining Cell Color

If we want to know the color of cell A4, we can use:

=CELL("color", A4)

This will return the color index of the cell.

Example 4: Checking Cell Contents

To fetch the contents of cell A5, we can employ the formula:


This will display the value stored in cell A5.

Applying CELL function for different application in Excel

Things to Remember

  • The info_type argument is case-insensitive.
  • When using the address or filename options, the reference argument is optional.
  • Using the CELL function in conjunction with merged cells or conditional formatting may not consistently produce the desired results.


The Excel CELL function serves as a valuable tool for extracting various details about cells within a worksheet. Its versatility and ease of use make it indispensable for tasks requiring information retrieval or analysis. By understanding its syntax, arguments, and output types, users can leverage the power of the CELL function to enhance their Excel proficiency.

Frequently Asked Questions

Can the CELL function be used to retrieve information from cells in other worksheets?

Yes, you can use the CELL function to retrieve data from cells across different worksheets by specifying the cell reference along with the worksheet name (e.g., ‘Sheet2’!A1)

Is it possible to use the CELL function to determine if a cell is formatted as text?

Yes, by using the “format” option and comparing the returned value to the text format code (“@”), one can ascertain if a cell has text formatting.

Can the CELL function return information about merged cells or cells with conditional formatting?

While the CELL function can return information about cells with basic formatting, it may not always provide accurate results when used with merged cells or cells with complex conditional formatting.

What are the different types of information that the CELL function can retrieve?

The CELL function can retrieve various types of information, including cell address, filename, sheet name, color, contents, format, and more.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *