Forum Discussion
KanwalNo1
Jun 21, 2021Iron Contributor
Join the results of two filtered tables in a single range
Hi, I am using the following formula to join the filtered results of two tables. Filter is resulting in 2 rows from 1st table and 10 rows from 2nd table. While the results of 1st table are corr...
SergeiBaklan
Jun 21, 2021Diamond Contributor
assuming you have same number of columns, rest of the formula will be as
...
m, SEQUENCE(,COLUMNS(oddarray)),
IF(k <= oddK,
INDEX(oddarray, k, m),
INDEX(evenarray, k-oddK, m)
)- KanwalNo1Jun 21, 2021Iron Contributor
=LET(
oddarray,FILTER(INDEX(BDBL2All,SEQUENCE(ROWS(BDBL2All),1),XMATCH(A6:G6,BDBL2Hdr)),IFNA(XMATCH(BDBL304Emami,$D$2)*(BDBL309IncoT="FOR")*ISNA(XMATCH(BDBL308Tptr,OwnVeh[Registered Owner])),0),0),
evenarray,FILTER(INDEX(BDBL2AllS,SEQUENCE(ROWS(BDBL2AllS),1),XMATCH(A6:G6,BDBL2HdrS)),IFNA(XMATCH(BDBL304Shree,$D$2)*(BDBL309IncoTS="FOR")*ISNA(XMATCH(BDBL308TptrS,OwnVeh[Registered Owner])),0),0),
oddK,ROWS(oddarray),
evenK,ROWS(evenarray),
k,SEQUENCE(oddK+evenK),
m,SEQUENCE(,COLUMNS(oddarray)),
n,SEQUENCE(,COLUMNS(evenarray)),
IF(k<=oddK,
INDEX(oddarray,k,m),
INDEX(evenarray,k-oddK,n))
)
Added n to avoid a single column array, in case oddk = 0
But I am still getting a ZERO valued row for oddarraySr.No. Consignor Truck Number Name of Registered Owner Balance 0 0 0 0 - 41 ShreeCL CG16CF0874 Raj Kumari Rai - 42 ShreeCL CG10AP8471 Ramesh Kumar Kashyap S/o Lakhan Lal Kashyap - 43 ShreeCL MP65H0290 Suresh Kumar Pandey S/o RM Budhsen Pandey - 44 ShreeCL CG04LU1753 Ashish Kumar Kesharwani - 45 ShreeCL CG04LE7276 Sumit Kesharwani S/o Bhagwat Kesharwani - 46 ShreeCL CG04LY6233 Ankit Agrawal S/o Raghuveer Prasad - - KanwalNo1Jun 21, 2021Iron Contributor
SergeiBaklan It is working perfectly except when oddk = 0 and/or evenk = 0
- SergeiBaklanJun 21, 2021Diamond Contributor
You may modify as
oddK,IFERROR(ROWS(oddarray),0), m, IFERROR(SEQUENCE(,COLUMNS(oddarray)), SEQUENCE(,COLUMNS(oddarray))), IF((k <= oddK) , INDEX(oddarray, k, m), INDEX(evenarray, k-oddK, m) )If both errors are empty you may wrap IF by IFERROR and return something like "empty table"