In the below, we have three columns - ASIN, Cost and FBA ID. How can I get an output which has each ASIN in a row mapped to each FBA ID in that row along with the cost in that row?
Taking the first row as an example, the result would look like:
The third row would be that single ASIN mapped to all those FBA IDs - each in its own row.
I imagine to achieve this it will be a mix of split, flatten and perhaps arrayformula but can't quite figure it out.
ASIN | LandedCostPrice_GBP | FBA ID |
---|---|---|
B0016B20EG_B004X892NG_B00IMTXIZ0 | £18.05 | FBA15GSZGXB6 |
B001QNGCF2_B000C212MG_B00B1AGNZY | £19.14 | FBA15GR6S1NX |
B002XZLAWM | £6.09 | FBA15H6KFL5D_FBA15H6LQ93R_FBA15H6SB6H0_FBA15H7WYT6K |
B003M0Y9YS_B07GNSFR3D | £4.99 | FBA15GSQV0VG |
B003NLXDI4_B000YDHQE6 | £29.25 | FBA15GMQLD2Y |
B003P30Z9U_B000C1Z6VA_B0097P42MQ | £36.16 | FBA15GPXV98B |
B003VRWN9A | £4.52 | FBA15H3CHV0J_FBA15H4WTQSM |
B0052EM8L8 | £10.76 | FBA15H6SB6H0_FBA15H77W12W |
B007VRDQR4 | £6.38 | FBA15H6FCCKF_FBA15H6GQN09 |
B009N38RFK_B086VXD7H5 | £6.31 | FBA15H2ZQ66T |
B00AU92W5M_B0009OAHVO | £19.30 | FBA15GSCNSQC |
B00BO8EVIE_B07GNRVCB5 | £4.64 | FBA15GSZDLTF |
B00CGPMEAQ | £6.00 | FBA15H90LKZ7_FBA15H90ML9V_FBA15H91MFS5 |
B00CGPMEAQ | £5.37 | FBA15H1C4YQG_FBA15H3JRPN8_FBA15H4524NJ_FBA15H4CGQTT_FBA15H4D4LXT |
B00CGPMEAQ | £5.37 | FBA15GSCSDVH_FBA15GT34KB3_FBA15GTVCMNC |
B00CGPMLDG | £4.14 | FBA15H69MT2N_FBA15H6BGWFC_FBA15H6GCQJD_FBA15H77NZ16_FBA15H8B9MG1_FBA15H8BBJCV |
B00CGPMLDG | £4.06 | FBA15H030B71_FBA15H09RGM6_FBA15H0LC93B |
You may try:
=let(Σ,index(match(,0/(A2:A<>""))),
reduce(tocol(,1),sequence(Σ),lambda(a,z,vstack(a,let(a,tocol(split(index(A2:A,z),"_")),c,tocol(split(index(C2:C,z),"_")),
if(counta(a)=counta(c),hstack(a,chooserows(index(B2:B,z),sequence(counta(a),1,1,0)),c),if(counta(a)>counta(c),hstack(a,chooserows(index(B2:C,z),sequence(counta(a),1,1,0))),hstack(chooserows(index(A2:B,z),sequence(counta(c),1,1,0)),c))))))))