How to write data into excel using conditions

I have one excel with 1 row of data.
I want write the data into another sheet based on condition.

  1. If invoice number (81113510467) is there we need to write the data into A cell ni sheet3
    If not A cell will be blank only .
  2. If filename contains.txt .we need to write the data into B cell in sheet3.
  3. Remaining data write in to C cell in sheet3.
  4. If in case invoice number or filename not there in Sheet2 excel
    We need to write the Remaining data into sheet3
    I am attaching the screenshot of input and output files in below .


    Sheet2 - input data
    Sheet3 - output data

Please suggest.