It should be a quickie to VBA/Excel experts. I have a large 60 to 2000 rows, wide 10,000 columns, table without headers in Excel, with the following format.
+---------+----------------+------------------+----------+ | | 20110811 | 20110810 | 20110810| +---------+----------------+------------------+----------+ | AA UN | 4.0111 | AA UN | 5.0222 | | AXP UN | 3.0611 | AXP UN | 3.0217 | | BA UN | 3.997 | BA UN | 4.0532 | | BAC UN | 0.4924 | BAC UN | 0.478 | | CAT UN | 5.9259 | CAT UN | 5.8959 | | CSCO UW | 1.0813 | CSCO UW | 0.9693 | | CVX UN | 6.3891 | CVX UN | 6.3943 | | DD UN | 3.1894 | DD UN | 3.165 | | DIS UN | 2.1815 | DIS UN | 2.2267 | | GE UN | 1.065 | GE UN | 1.0654 | +---------+----------------+------------------+----------+
The question is how to get a unique list of text cells out from the whole table, I have been playing with advanced autofilter but it really doesnt give what i want. Im looking for smth like that below
╔═════════╗ ║ AA UN ║ ║ AXP UN ║ ║ BA UN ║ ║ BAC UN ║ ║ CAT UN ║ ║ CSCO UW ║ ║ CVX UN ║ ║ DD UN ║ ║ DIS UN ║ ║ GE UN ║ ╚═════════╝
Btw, thanks to GSerg for formatting, now i learnt a new trick
One solution is to dump the entire range into a variable array and then loop through it adding entries that aren’t numbers into a dictionary object. That will eliminate all dupes and non-numeric data. Take the dictionary keys and transpose them back on the sheet.
UPDATE:
Here is code you can use.
How it works: You’ll can adjust the range (right now it’s all cells used), but it will dump every cell into a variant array in one shot. Then it goes through the array (much faster than going through cells) and if the entry is not empty, nor numeric, it adds it to a dictionary object. Since you can’t put 2 keys that are the same into a dictionary, it just skips over all dupes automatically. Then I paste the unique list into sheet2 (you can adjust this as well).