Forum Discussion

udonlover's avatar
udonlover
Copper Contributor
May 19, 2024

Question about categorizing transactions from bank statement in EXCEL

I have a problem of categorizing every transaction in the bank statement for bookkeeping purposes.

 

As shown below, I have to input the Description for every item, and every item has to refer to different columns. 

 

For example, if we see "CHECK NO" in REf 2, we have to input "*Look up in other excel file*".

If "John" appears in REF2, we have to input "JOHN CO. -BC".

If "BOOKTRANSFER" appears in "BANK TRAN. DESCRIPTION", we have to input "BOOKTRANSFER DR. ABC CR. Def".

If 360.9(DEBIT) and PAY TO CAR. CO(REF4) appears at the same time, than "VEHICLE LOAN - TOYOTA 123" (I still cannot figure out how to write this rule).

 

There are hundreds of these rules.

 

I wrote a function, like

=IFS(ISNUMBER(SEARCH(("BOOKTRANSFER"),CONCAT(B6,F6:K6),1)),"BOOKTRANSFER DR.ABC CR. Def",
ISNUMBER(SEARCH(("John"),CONCAT(B6,F6:K6),1)),"JOHN CO. - BC",
ISNUMBER(SEARCH(("CHECK NO"),CONCAT(B6,F6:K6),1)),"*Look up in other excel file*"),

and drag it down in cell E, to facilitate my job.

 

However, I cannot enter every single rules into a cell, and it would be very long and complicated. It is also difficult to modify.

 

 

 

I just wonder whether I can do it with a table or not, like this:

 

so I can input hundreds of rules.

But I still cannot figure out how to do it with a table.

Please advise if there is a smarter way to do the job.

Thank you.

 

(P.S. Reply in Chinese and English are welcomed)

  • udonlover 

    =IFNA(
    IFNA(
    IFNA(
    IFNA(
    IFNA(
    IFNA(
    IFNA(

    INDEX(Filling!$A$2:$A$11,MATCH(1,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$K2))*(Filling!$B$2:$B$11=$F2),0)),
    INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$H2)),0))
    ),
    INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$I2)),0))
    ),
    INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$J2)),0))
    ),
    INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$K2)),0))
    ),
    INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$L2)),0))
    ),
    INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$M2)),0))
    ),INDEX(Filling!$A$2:$A$11,MATCH(TRUE,ISNUMBER(SEARCH(Filling!$C$2:$C$11,$D2)),0)))

     

    In the formula in the bank statement file i've adapted the ranges from e.g. Filling!$A$2:$A$200 to Filling!$A$2:$A$11 because there is only criteria up to row 11 in the Filling sheet.

    In addition the INDEX and MATCH highlighted in red is now evaluated in the first step of the whole nested formula. Before it was evaluated in the last step (but only if all other INDEX and MATCH formulas returned an error).

     

    I understand that the formula i suggested earlier works well and i'm glad it does but can't explain how it works at the moment.

    • udonlover's avatar
      udonlover
      Copper Contributor

      OliverScheurich 

      Thank you very much! This is what exactly I want!

      Could you please explain more about the INFA, Index, and Match functions?

       

      Also, I would be pleased if I could put the table on a separate worksheet.

       

      Thank you very much for your excellent work.

      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        udonlover 

        =IFNA(IFNA(INDEX(Tabelle2!$C$2:$C$100,MATCH(TRUE,ISNUMBER(SEARCH(Tabelle2!$B$2:$B$100,G5)),0)),INDEX(Tabelle2!$C$2:$C$100,MATCH(TRUE,ISNUMBER(SEARCH(Tabelle2!$B$2:$B$100,B5)),0))),INDEX(Tabelle2!$C$2:$C$100,MATCH(1,ISNUMBER(SEARCH(Tabelle2!$B$2:$B$100,I5))*(Tabelle2!$A$2:$A$100=D5),0)))

         

        You are welcome. If the INDEX and MATCH function highlighted in red returns #NA then the IFNA highlighted in blue evaluates the INDEX and MATCH highlighted in green.

         

        If the INDEX and MATCH function highlighted in green returns #NA then the IFNA highlighted in purple evaluates the INDEX and MATCH function highlighted in grey.

         

        If the INDEX and MATCH function highlighted in grey returns #NA then the whole nested formula returns the #NA error.

  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor

    udonlover 

     

    Sql:

    select * from bank_transfer limit 20;

    select * from bank_transfer_refer limit 20;

    //select * from bank_transfer_refer where keywords like '360.9%pay to car. Co' ;

    select bank_transfer.rowid,* from bank_transfer left join bank_transfer_refer on bank||credit||debit||ref1||ref2||ref3||ref4||ref5 like '%'||keywords||'%' order by bank_transfer.rowid;

     

    • udonlover's avatar
      udonlover
      Copper Contributor
      Thank you for showing the SQL approach!
      Unfortunately, as I have nearly no knowledge about SQL, could you please explain how to apply SQL to an Excel file step by step?