excel formula not working with python code

Harmandeep

New Member
Joined
Dec 19, 2022
Messages
19
Office Version
  1. 365
Platform
  1. Windows
i have one excel formula
(=IF(TEXT(B2,"MMM")=$X$2,IF(R2=S2,"Matched-Settled in " & TEXT(M2,"MMMM"),IF(S2="0","Not in Axinom",IF(AND(COUNTIF($I$2:$I$300000,I2)>1,(R2<0)),"Refund/Cancelled",IF(AND(R2<S2,R2>-1),"Discount","Unknown Error")))),"Not related to this month") )

which i have converted to use in python

df2['Remarks'] = [f"=IF(TEXT(B{i + 2},'MMM')=$X$2,IF(R{i + 2}=S{i + 2},'Matched-Settled in ' & TEXT(M{i + 2},'MMMM'),IF(S{i + 2}=0,'Not in Axinom',IF(AND(COUNTIF($I$2:$I$300000,I{i + 2})>1,(R{i + 2}<0)),'Refund/Cancelled',IF(AND(R{i + 2}<S{i + 2},R{i + 2}>-1),'Discount','Unknown Error')))),'Not related to this month')" for i in range(len(df2))]

python code run this code successfully but while opening excel file given error "We found problem with some content".When i open the excel file remarks column is blank rest all the file seems fine.

Please help me out to correct this formula in Python.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top