I'm having some difficulty combining several functions to do what I want in a 70000+ line excel file. ANY tips or pointers or advice greatly appreciated.
I have 2 columns (about 70000 lines worth). In column 1 I have account numbers for clients (there are duplicates), next to it in column 2 I have the data I want to extract. I also have a third column (column 3) which is a list of the account numbers but has been stripped of duplicates. I am trying to us Vlookup to look at line one of Column three (lookup_value) then search for that value in columns 1 within (table_array), and return the value from column 2 that is adjacent to the column 1 value.
Problem, I want Vlookup to perform this function for all 70000 rows, such that, it returns all the data that matches that particular account number provided to it with (lookup_value). THEN, I want to use the Combine function to put the string of data into a single cell using this Combine function:
Function Combine(WorkRng As Range, Optional Sign As String = ", ") As String
'Update 20130815
Dim Rng As Range
Dim OutStr As String
For Each Rng In WorkRng
If Rng.Text <> ", " Then
OutStr = OutStr & Rng.Text & Sign
End If
Next
Combine = Left(OutStr, Len(OutStr) - 1)
End Function
Ultimately, next to column 3, I'd like the data to be separated by commas in a single cell, next to each account number. Below is an example of what I'm trying to do. I have the first 3 columns, but I want to convert it into the 4th column.
Acct # Data Accounts Desired Data formating
1001 80100 1001 80100, 80250, 80255
1001 80250 1005 81000, 81222, 81235, 85213
1001 80255 1099 82250, 82323, 80100, 80150
1005 81000
1005 81222
1005 81235
1005 85213
1099 82250
1099 82323
1099 80100
1099 80105
I thought this would be a simple function or formula, but maybe I'm not using the right one(s).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…