google-sheets-formulagoogle-sheets-filter-view

Is If/else AND order by within a join possible?


I have N tables each in its own sheet combined into one master table but I need to sort out empty rows and sort the output alphabetically.

Working example

Is that even possible to combine?


Solution

  • This too long formula, but can still give the hoped result

    ={Nema!A2:F2; array_constrain(sort({Staff!A3:A9,Staff!B3:F9,row(Staff!A3:A9)-row(Staff!A1);
    sort(FILTER (
    { 
     left(Nema!A1:A9,0) & Nema!A1,Nema!B1:F9,row(Nema!A1:A9)-row(Nema!A1);
     left(Flash!A1:A9,0) & Flash!A1,Flash!B1:F9,row(Flash!A1:A9)-row(Flash!A1);
     left(Muhammad!A1:A9,0) & Muhammad!A1,Muhammad!B1:F9,row(Muhammad!A1:A9)-row(Muhammad!A1);
     left(Allan!A1:A9,0) & Allan!A1,Allan!B1:F9,row(Allan!A1:A9)-row(Allan!A1);
     left(Joy!A1:A9,0) & Joy!A1,Joy!B1:F9,row(Joy!A1:A9)-row(Joy!A1)
    
    },
    {  
       row(Nema!A1:A9)-row(Nema!A1);
       row(Flash!A1:A9)-row(Flash!A1);
       row(Muhammad!A1:A9)-row(Muhammad!A1);
       row(Allan!A1:A9)-row(Allan!A1);
       row(Joy!A1:A9)-row(Joy!A1)
    }>1,
       {
         Nema!A1:A9;
         Flash!A1:A9;
         Muhammad!A1:A9;
         Allan!A1:A9;
         Joy!A1:A9
       }<>"",
       {
         Nema!B1:B9 & Nema!C1:C9 & Nema!D1:D9 & Nema!E1:E9 & Nema!F1:F9;
         Flash!B1:B9 & Flash!C1:C9 & Flash!D1:D9 & Flash!E1:E9 & Flash!F1:F9;
         Muhammad!B1:B9 & Muhammad!C1:C9 & Muhammad!D1:D9 & Muhammad!E1:E9 & Muhammad!F1:F9;
         Allan!B1:B9 & Allan!C1:C9 & Allan!D1:D9 & Allan!E1:E9 & Allan!F1:F9;
         Joy!B1:B9 & Joy!C1:C9 & Joy!D1:D9 & Joy!E1:E9 & Joy!F1:F9
       }<>""),1,true)}   ,7,1),1000,6)}