Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V26.2
  • Cell Error Values

    • 2 minutes to read

    If a cell contains an invalid formula, the cell displays an error. Use the Cell.Value property to obtain the SpreadsheetError type. Also, the API sets CellValue.Type to CellValueType.Error for a cell with an error.

    Use the CellValue.ErrorValue property to obtain the type of an error contained in a cell. This property gets a SpreadsheetError value.

    Type

    Name

    Description

    Sample

    DivisionByZero

    #DIV/0!

    Division by zero!

    cell.Formula = "= 10/0"

    cell.Formula = "= A1/B2" - the B2 cell is blank

    Name

    #NAME?

    Function does not exist.

    cell.Formula = "= FALS" - The function name used in the formula is not spelled correctly.

    cell.Formula = "=SUM(A1B2)" - A colon (:) is missing in the cell range reference.

    NotAvailable

    #N/A

    The value is not available to a function or formula.

    cell.Formula = "= NA()"

    cell.ArrayFormula = "=SUM(A1:A5*A1:B3)" - Array formula arguments are arrays consisting of different numbers of elements.

    Null

    #NULL!

    The specified intersection includes two ranges that do not intersect.

    cell.Formula = "=SUM(A1:A5 E6:E8)" - The specified ranges do not intersect, so the sum cannot be calculated.

    Number

    #NUM!

    Invalid numeric values in a formula or function.

    cell.Formula = "=SQRT(-16)" - The square root of a negative number cannot be calculated.

    Reference

    #REF!

    Cell reference is not valid.

    A formula refers to a cell, and code deletes the column that contains this cell:

    cell.Formula = "=5+D2"

    worksheet.DeleteColumns(3);

    Value

    #VALUE!

    The value used in the formula is of the wrong data type.

    cell.Formula = "=SUM(\"text\", 6)" - The SUM function requires numeric arguments.

    A formula refers to a blank cell that is not actually empty (it contains an empty string):

    worksheet["A1"].Value = "";

    cell.Formula = "= A1 + 5";