Skip to content Skip to sidebar Skip to footer

Using Result Of Formula In Another Calculation

I would like to use the value calculated in the second, 'for i in range' statement to calculate a new value using the fourth, 'for i in range' statement; however, I receive the err

Solution 1:

Unfortunately that's not quite possible because

openpyxl never evaluates formula

There are other libraries that may do so. However your problem can be overcome by recognizing that you can use yet another cell reference instead of the calculated value here.

for i in range(2,80):
    sheet['I{}'.format(i)] = '=E{}*37.5/H{}'.format(i,i)

Note that you can't set the value for the Ix cell because you don't actually have a value for the Ex or Hx cells. (well you might have but it's not clear from your question if you do)

Post a Comment for "Using Result Of Formula In Another Calculation"