compare 2 cells and update result in another cell in excel using xlwt python

167 Views Asked by At

I have excel that col A and col B like below:

  A       B   
 KIWI   KIWI
 APPLE  APPLE
 ORANGE  BANANA

I need to compare the contents in col A and col B and if they matches write match/not match in col C like below.

  A         B        C
 KIWI    KIWI     Matched
 APPLE   APPLE    Matched
 ORANGE  BANANA   Not Matched

I am using xlwt to write excel.I can use xlrd to read and xlwt to write again.But to do this I need to open the same sheet twice.

please help me is there any better way to do this .

1

There are 1 best solutions below

1
On

Have you tried using an if compare formula in column C instead =if(a1=b1,matched, not matched)?