Insert formula using Openpyxl

68 views
Skip to first unread message

The Tester Boy

unread,
Apr 21, 2024, 8:21:17 AMApr 21
to openpyxl-users
In python:
I am trying to insert this formula : =@FILTER(CP!$B$5:$B$13,(TDS_Conso_Summary!E2=CP!$A$5:$A$13)*(TDS_Conso_Summary!F2=CP!$C$5:$C$13))

but I am unable to, the code is executed but the excel removes it automatically.

Instead of using @ operator I tried using index, even that didn't work 
Code:
for row in range(2,ws_TDS_Conso_Summary.max_row+1):

formula = f"=INDEX(FILTER(CP!$B$5:$B$13, (TDS_Conso_Summary!E{row}=CP!$A$5:$A$13)*(TDS_Conso_Summary!F{row}=CP!$C$5:$C$13)), 1)"
ws_TDS_Conso_Summary[f'K{row}'] = formula

Error in excel:
Refer attachment

Screenshot 2024-04-21 174733.png
Screenshot 2024-04-21 174834.png
Reply all
Reply to author
Forward
0 new messages