Skip to content Skip to sidebar Skip to footer

Python/excel: Compare The Given Value With The Summed Value

Excel Image 1 From 'Excel Image 1', I am pulling data into python of Column A and Column B. The goal is to sum the values of Column B, and see whether it is higher or lower than th

Solution 1:

You know the delta - excel_sum - calc_sum. So scan column C for a change, and add it to column B.

else:
    forrowinrange(3, sh1.nrows):
        if sh1.cell(row, 2) =='change':
            colB[row] =int(sh1.cell(row, 1)) + excel_sum - calc_sum
            break

Of course, I see you using xlrd but not xlwt, so I don't know how you're going to change the value. Do you?

Post a Comment for "Python/excel: Compare The Given Value With The Summed Value"