Skip to content

Commit

Permalink
If there is a cell error set the cell to an errored value
Browse files Browse the repository at this point in the history
  • Loading branch information
dustingtorres committed Oct 3, 2019
1 parent 689c591 commit be8548d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion formulas/excel/__init__.py
Expand Up @@ -24,6 +24,8 @@
import numpy as np
import os.path as osp
import schedula as sh

from formulas.errors import FormulaError
from ..ranges import Ranges
from ..cell import Cell, RangesAssembler
from ..tokens.operand import range2parts, XlError
Expand Down Expand Up @@ -202,7 +204,11 @@ def add_cell(self, cell, context, references=None, formula_references=None,
ctx.update(context)
crd = cell.coordinate
crd = formula_references.get(crd, crd)
cell = Cell(crd, cell.value, context=ctx).compile()
try:
cell = Cell(crd, cell.value, context=ctx).compile()
except FormulaError as e:
# There was an error so set this value with the NA error using the excel function
cell = Cell(crd, "=NA()", context=context).compile()
if cell.output in self.cells:
return
if cell.value is not sh.EMPTY:
Expand Down

0 comments on commit be8548d

Please sign in to comment.