I think that the "-1" you were seeing is just an untrapped status returned by the bit of code "$.workbooks.Close".
UNIQ() and QSORT() work only with single dimension arrays, so will never work with the two dimensional array that you are returning from ReadExcel2()
The simplest fix for you is to create a couple of single dimension arrays of the right size and copy each of the "columns" into them, after which you can pass them to UNIQ() / QSORT().
The complex solution is to update the UDFs to support multi-dimension arrays, but if you think about it a bit you'll realise that it's not what you want it to do - you actually want to treat the columns as seperate lists, so you might as well split them up.
So if I am to understand this, as far as how to proceed.
- Loop through the second column array and create a string - I think writing directly to a new array might be beyond me unless there is some template code to understand and accomodate to my needs.
- Convert string to array
- qsort() then uniq() results
- work with as previously discussed using isinarray() and join() to validate input and output valid results to user.
I do understand what you mean about the complexities of the 2D array and having it adapted to single dimension array functions like those I wish to use for my work.
Pax