The source file contains 17k to 20k rows.
I'm struggling with the speed of calculating, the sheet is unresponsive for 60+ seconds. There are 14 executions of this function per sheet, and 6 sheets exist.
I've tried doing it with a filter function and it is super slow.
=FILTER({
{Source!B2:B,Source!R2:S};
{Source!B2:B,Source!T2:U};
{Source!B2:B,Source!V2:W};
{Source!B2:B,Source!X2:Y};
{Source!B2:B,Source!Z2:AA};
{Source!B2:B,Source!AB2:AC};
{Source!B2:B,Source!AD2:AE};
{Source!B2:B,Source!AF2:AG};
{Source!B2:B,Source!AH2:AI};
{Source!B2:B,Source!AJ2:AK};
{Source!B2:B,Source!AL2:AM};
{Source!B2:B,Source!AN2:AO}
},
{Source!R2:R;Source!T2:T;Source!V2:V;Source!X2:X;Source!Z2:Z;Source!AB2:AB;Source!AD2:AD;Source!AF2:AF;Source!AH2:AH;Source!AJ2:AJ;Source!AL2:AL;Source!AN2:AN}=$B$1,
{Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B;Source!B2:B}=$B$2)
Then I tried with a Query, this works, but it is still slow as it is, and unfinished
={QUERY(
QUERY(
Source!A2:AO,"SELECT B,R,S WHERE B='"&B2&"'"),"SELECT Col1,Col2,Col3 WHERE Col2='"&B1&"'");
QUERY(QUERY(Source!A2:AO,"SELECT B,T,U WHERE B='"&B2&"'"),"SELECT Col1,Col2,Col3 WHERE Col2='"&B1&"'");
QUERY(QUERY(Source!A2:AO,"SELECT B,V,W WHERE B='"&B2&"'"),"SELECT Col1,Col2,Col3 WHERE Col2='"&B1&"'")}
The last thing that I've tried to mess with is this, but it works only for the first set:
=QUERY(
QUERY(
Source!A2:AO,"SELECT B,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO WHERE B='"&B2&"'"),
{("SELECT Col1,Col2,Col3 WHERE Col2='"&B1&"'");
("SELECT Col1,Col4,Col5 WHERE Col4='"&B1&"'");
("SELECT Col1,Col6,Col7 WHERE Col6='"&B1&"'");
("SELECT Col1,Col8,Col9 WHERE Col8='"&B1&"'");
("SELECT Col1,Col9,Col10 WHERE Col10='"&B1&"'");
("SELECT Col1,Col11,Col12 WHERE Col12='"&B1&"'")
})
The requirement does not look complicated, my knowledge of the subject is a bit limited. Any help is appreciated.
I cannot provide a shared sheet, I'm really sorry.
The expected result needs to be:
Column A | Column B | Column C |
---|---|---|
data 1 | Text 1 | RndNumber1 |
data 1 | Text 1 | RndNumber2 |
data 1 | Text 1 | RndNumber3 |
data 1 | Text 1 | RndNumber2 |
data 1 | Text 1 | RndNumber4 |
try loading ranges only once:
=LET(b,Source!B2:B,
r,OFFSET(b,,16,,2),
t,OFFSET(b,,18,,2),
v,OFFSET(b,,20,,2),
x,OFFSET(b,,22,,2),
z,OFFSET(b,,24,,2),
ab,OFFSET(b,,26,,2),
ad,OFFSET(b,,28,,2),
af,OFFSET(b,,30,,2),
ah,OFFSET(b,,32,,2),
aj,OFFSET(b,,34,,2),
al,OFFSET(b,,36,,2),
an,OFFSET(b,,38,,2),
FILTER({{b;b;b;b;b;b;b;b;b;b;b;b}, {r;t;v;x;z;ab;ad;af;ah;aj;al;an}},
$B$2={b;b;b;b;b;b;b;b;b;b;b;b},
$B$1={INDEX(r,,1);INDEX(t,,1);INDEX(v,,1);INDEX(x,,1);INDEX(z,,1);INDEX(ab,,1);INDEX(ad,,1);INDEX(af,,1);INDEX(ah,,1);INDEX(aj,,1);INDEX(al,,1);INDEX(an,,1)}))
instead of building array of 12 × 20k = 240k rows let's do double filter-down. first from 20k rows to x
rows and then from x
rows to final output:
=LET(x, WRAPROWS(TOROW(FILTER(Source!R2:AO, Source!B2:B=B2),,), 2),
FILTER({IF(INDEX(x,,1)="",,B2), x}, INDEX(x,,1)=B1))