Search code examples
google-sheetsgoogle-sheets-formula

Get Orders that employes have worked on


So i am having a hard time doing what i want to do, basicly i have 2 Google sheets, one with orders, and one with employes, what i am trying to do is, on the employes sheet, i want to go to the orders sheet with FILTER() and IMPORTRANGE() and get all orders that X employe worked on, and i know how to do that if one employe only works in one Order, the problem is if i have 2 employes working on the same order, is that even possible?

Orderns Sheet

This is what i want to get Employe Sheet

This is how i am getting the Order list on the Employe Sheet if i only have 1 employe on an order and it works fine:

=FILTER( IMPORTRANGE(VLOOKUP('Orders url';Orders!$A:$B;2;);"Registo!$A$2:$K"); IMPORTRANGE(VLOOKUP('Orders url';Orders!$A:$B;2;);"Registo!$C$2:$C")=A2 )


Solution

  • You can use this formula:

    =FILTER(
      IMPORTRANGE(VLOOKUP('Orders url';Orders!$A:$B;2;);"Registo!$A$2:$K"); 
      MAP(
        IMPORTRANGE(VLOOKUP('Orders url';Orders!$A:$B;2;);"Registo!$C$2:$C"); 
        LAMBDA(empl; NOT(ISNA(MATCH(A2; SPLIT(empl; ","); 0))))
      )
    )
    

    In case you use employee ids, it will avoid "collisions", for example, matching orders of employee 1 when employee 12 worked on the order.