Forum Discussion
Lists Comparison (Stacked & Keeping order)
- Jan 02, 2025
Interesting project. I see you've found a solution but indicate there are still performance issues with larger amounts of data. One thing to keep in mind is that iterative functions like MAKEARRAY, MAP, SCAN and REDUCE will perform very poorly when using INDEX over an array object (as opposed to a physical range). This may be a contributing factor since a number of your custom functions use iterative indexing methods (not to mention some iterative stacking as well).
In the attached file I've used an alternative approach for generating the list of matching indices and row counts, then used SORTBY with EXPAND and TOCOL-IFS-SEQUENCE to pad each array with the appropriate number of blank rows. It seems to be generating the same results as your original formulas, plus it can handle 5 separate lists with 2000 rows each in < 1 second. I've put the new lambda definitions on a separate worksheet, for your convenience. Check it out and see if it's working as expected. Cheers!
Thanks but the original order of array elements should remain same, that is the requirement.
So yes, the same elements must align in same row, but within each array, the sequence of elements must remain same in output.
Such type of comparison is useful, e.g. in comparing text documents, like code comparisons (which line got deleted/added/remained same). Other use cases could be comparison of multiple products features and specifications grouped by categories from top to bottom.
I could make the solution but it is slow.
- peiyezhuJan 02, 2025Bronze Contributor
Re:like code comparisons (which line got deleted/added/remained same).
vimdiff
or
diff