IF formula for write cell problem problem

Hi,

My suggestion would be on your issue is we can delete the rows in data table itself before writing the data to excel with using remove data row activity in UiPath by using condition you mentioned. Please refer the below link for guidance.