Forum Discussion

Noortje Vollenberg's avatar
Noortje Vollenberg
Copper Contributor
Jul 18, 2017
Solved

Need help with very complex formula (conditional/if/find/lookup/sum?)

I'm looking for some help creating a complex formula. As in, so complex I am not even sure if this is doable. Let me first explain how the file is built up (I can't share it, as it contains confident...
  • SergeiBaklan's avatar
    Jul 18, 2017

    Hi Noortje,

     

    Better to have your data bit more structured and use at least some elements of data model (e.g tables with relationships), but we have what we have. And not sure i understood how you'd like to structure the results, thus here is quite row prototype to illustrate the approach on simple data

     

    Left part imitates your first sheet, after that second one and finaly results for Jan column.

     

    Formula for total is

    =SUMPRODUCT($H$2:$H$600*NOT(ISNA(MATCH($F$2:$F$600,($A$2:$A$600)*($D$2:$D$600=$K2),0))))

    Part under MATCH filters customers codes in second sheet (F:F) selecting all customers (A:A) for whom name of the manager (D:D) is in K2. ISNA returns TRUE (1) if no matches and zero otherwise, with NOT we convert 1 to 0 and opposite. After that you we multiple that array of 1 and 0 on revenue (H:H), excluding not needed by multiplying on 0, and finally sum the result (SUMPRODUCT).

     

    Under the MATCH we may add as many filters as needed, e.g for new revenue (C:C = 2017) it'll be

    =SUMPRODUCT($H$2:$H$600*NOT(ISNA(MATCH($F$2:$F$600,($A$2:$A$600)*($D$2:$D$600=$K2)*($C$2:$C$600=2017),0))))

    Please see the file attached. Again, that's only prototype.

     

     

     

     

     

Resources