You can use these custom functions to accomplish this.
How to install the User Defined Functions:
1. Open up your workbook
2. Get into VB Editor (Press Alt+F11)
3. Insert a new module (Insert > Module)
4. Copy and Paste in your code (given above)
5. Get out of VBA (Press Alt+Q)
6. Save as a macro-enabled workbook
The functions are installed and ready to use.
The function is used in a cell like a normal formula. IN your example workbook you would enter this formula in B1:
=CreateSortedArray(A1:A6, CHAR(10), 4)
Explanation:
=CreateSortedArray(MyRange As Range, Delim As String, SortLen As Long)
MyRange As Range - the range of cells to evaluate in the formula
Delim As String - the string that will separate the concatenated values. Char(10) is the text value of a linefeed
SortLen As Long - how many characters of each string to use for sorting, also how many numbers are used when a long number is split out into individual numbers.
Bookmarks