Hello,
I am looking for some help or to repurpose a simple macro to do two things. I have a table of data that consists of a few columns of consistent data (ex. vendor names and vendor numbers) and then one column with cells full of comma delimited invoice numbers.
What I would like to do is convert the comma delimited cells into columns (easy enough, with the Text to Columns function), but then I would like to reformat the result into individual rows for each unique invoice, with the new rows maintaining the vendor name's and ID's that the existing line contains.
Example original:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor Name[/TD]
[TD]Vendor Number[/TD]
[TD]Invoices[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-1, 5000-2, 5000-3[/TD]
[/TR]
</tbody>[/TABLE]
Example after text to columns:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor Name[/TD]
[TD]Vendor Number[/TD]
[TD]Invoices[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-1[/TD]
[TD]5000-2[/TD]
[TD]5000-3[/TD]
[/TR]
</tbody>[/TABLE]
Example result:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor Name[/TD]
[TD]Vendor Number[/TD]
[TD]Invoice[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-3[/TD]
[/TR]
</tbody>[/TABLE]
I have one vendor that has up to 69 invoices contained in one cell and using text to columns over the existing data results in 29,000 unique invoice records, from approximately 8,000 rows of vendors.
Hoping someone might be able to help out with a simple macro for creating and populating all of the unique records for each vendor.
Thanks in advance!
I am looking for some help or to repurpose a simple macro to do two things. I have a table of data that consists of a few columns of consistent data (ex. vendor names and vendor numbers) and then one column with cells full of comma delimited invoice numbers.
What I would like to do is convert the comma delimited cells into columns (easy enough, with the Text to Columns function), but then I would like to reformat the result into individual rows for each unique invoice, with the new rows maintaining the vendor name's and ID's that the existing line contains.
Example original:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor Name[/TD]
[TD]Vendor Number[/TD]
[TD]Invoices[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-1, 5000-2, 5000-3[/TD]
[/TR]
</tbody>[/TABLE]
Example after text to columns:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor Name[/TD]
[TD]Vendor Number[/TD]
[TD]Invoices[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-1[/TD]
[TD]5000-2[/TD]
[TD]5000-3[/TD]
[/TR]
</tbody>[/TABLE]
Example result:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor Name[/TD]
[TD]Vendor Number[/TD]
[TD]Invoice[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]XYZ Company[/TD]
[TD]12345[/TD]
[TD]5000-3[/TD]
[/TR]
</tbody>[/TABLE]
I have one vendor that has up to 69 invoices contained in one cell and using text to columns over the existing data results in 29,000 unique invoice records, from approximately 8,000 rows of vendors.
Hoping someone might be able to help out with a simple macro for creating and populating all of the unique records for each vendor.
Thanks in advance!
Last edited: