Home > Articles > Computer Software > Office > Spreadsheets > Excel

Exploring Excel's Functions Part 3: CELL() Shocked

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
You might guess that the CELL() function has something to do with worksheet cells, but exactly what does it do? This often-overlooked function is one of Excel's information functions, so-called because their jobs are to provide information about certain aspects of the worksheet. In this third article in a series on Excel's advanced functions, Peter Aitken shows you how to take advantage of the CELL() function's capabilities to make your workbooks stand out in terms of usability and convenience.

You might guess that the CELL() function has something to do with worksheet cells—but exactly what? It is one of Excel’s information functions, so-called because their job is to provide information about certain aspects of the worksheet.

A Hard Cell

The CELL() function can tell you a lot of things about a specified worksheet cell. It needs two pieces of information to work, and the syntax is as follows:

CELL(info_type, reference)

Reference tells the function which cell you are interested in. It can be a cell address or range name. If reference refers to a range of more than one cells, CELL() returns information about the top-left cell in the range.

Info_type is a text value that tells the function what information you want. The following table gives all the possibilities. Some of them will be explained in more detail later in the article.

Value of Info_type

Information Returned by CELL()

"address"

The address of the cell as an absolute cell reference (for example, $A$2).

"col"

The column number of the cell.

"color"

1 if the cell is formatted to display negative values in color; 0 otherwise.

"contents"

The contents of the cell. If the cell contains a formula, the result is returned, not the formula itself.

"filename"

The filename, including path, and sheet name where the cell is located. The workbook must have been saved for this option to work.

"format"

A text value indicating the number format applied to the cell. For example, "G" is returned for General format, and "D3" for the mmm-yy date format. See Excel help for a complete listing of return values.

"parentheses"

1 if the cell is formatted with parentheses for positive or all values; 0 otherwise.

"prefix"

Text value corresponding to the label alignment prefix of the cell. Returns a 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.

"protect"

1 if the cell is locked; 0 if it is not locked

"row"

The row number of the cell.

"type"

Text value indicating the type of data in the cell. Returns "b" if the cell is empty, "l" if the cell contains text, and "v" for anything else (numbers, formulas, and so on).

"width"

The width of the cell, rounded to an integer, expressed as number of characters in the default font size.

You can see that the CELL() function is quite flexible, but is there anything really useful you can use it for? Oh yes! Let’s look at some specific examples.

  • Share ThisShare This
  • Your Account

Discussions

Make a New Comment

You must log in in order to post a comment.

Related Resources

Lisa Jacobson-BrownWill you review our books?
By Lisa Jacobson-Brown on August 16, 2010 No Comments

One of the most important jobs we have as a publicity department is to give our customers a good idea of how valuable a book will be – and the best way to do that is to get the book out there and have you review it.

What can Que do for YOU?
By Loretta Yates on August 6, 2010 No Comments

Lots of great info on Microsoft Office 2010, Expression Web 4, and much more coming your way!

Emily NaveCommunity Tips: Starting a User Group Library
By Emily Nave on August 4, 2010 No Comments

The Central Penn Adobe User Group (CPAUG) uses a library program to share books from different publishers with members. A short Q&A with group leader Megan Fister provides some great tips for starting your own.

See All Related Blogs

Informit Network