Microsoft KB Archive/98981

= Microsoft Knowledge Base =

Excel: Using GET.CELL to Detect an Apostrophe in a Cell
Last reviewed: September 12, 1996

Article ID: Q98981

The information in this article applies to:


 * Microsoft Excel for Windows, versions 4.0, 4.0a
 * Microsoft Excel for the Macintosh, version 4.0

SUMMARY
In Microsoft Excel version 4.0, you can determine whether or not a cell begins with an apostrophe (') by using the GET.CELL macro function with a type_num argument of 52.

MORE INFORMATION
The macro function GET.CELL(52) returns the cell prefix or text alignment character of the active cell, if it contains one, or a null text string if it does not. For example, given the following entries on a worksheet:

A1:  'Example A2:  &quot;Example&quot; A3:   Example A4:  =&quot;Example&quot; A GET.CELL(52) of cell A1 will return an apostrophe. The other cells do not contain a cell prefix or text alignment character, so performing a GET.CELL(52) on any of cells A2, A3, or A4 will return &quot;&quot;, which is a null text string.

The LEFT function cannot be used to determine whether a cell begins with an apostrophe. This is because the LEFT function uses the characters that are visible in the cell itself, not the characters that are visible in the formula bar. For example, if you used the sample data from above:

Formula         Returns

=LEFT(A1,4)      Exam =LEFT(A2,4)      &quot;Exa =LEFT(A3,4)      Exam =LEFT(A4,4)      Exam Note that GET.CELL is a macro function and therefore cannot be entered on a worksheet.