Harmandeep
New Member
- Joined
- Dec 19, 2022
- Messages
- 19
- Office Version
- 365
- Platform
- 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.
(=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.