Copy a row and split a cell

th081

Board Regular
Joined
Mar 26, 2006
Messages
98
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a access table and it has a column with data like below:

Invoice
36573
56893
10982|10356|76854
67943
19987|25045
10236

I want the third and fifth row to just have one invoice number with the rest of the columns copied from the same row.

Can anyone help. This is my first foray into access macros. I googled something about a split function which I think would split the cell.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
If this is in a table, then you can bring the table into Power Query and split the column into separate rows. Once you have this parsed, you can then replace the table in question with the new table. Mcode for doing this

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Table.TransformColumnTypes(Source, {{"Invoice", type text}}, "en-US"), {{"Invoice", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Invoice")
in
    #"Split Column by Delimiter"

Book6
A
1Invoice
236573
356893
410982
510356
676854
767943
819987
925045
1010236
Sheet4
 
Upvote 0
If this is in a table, then you can bring the table into Power Query and split the column into separate rows. Once you have this parsed, you can then replace the table in question with the new table. Mcode for doing this

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Table.TransformColumnTypes(Source, {{"Invoice", type text}}, "en-US"), {{"Invoice", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Invoice")
in
    #"Split Column by Delimiter"

Book6
A
1Invoice
236573
356893
410982
510356
676854
767943
819987
925045
1010236
Sheet4
@alansidman
But this is an Access table? :unsure:
 
Upvote 0
Yes, this is an access table. Is there a way to do it in access.

Otherwise I was going to export the data from access use power query and then put it back into access
 
Upvote 0
No, that was directed to alanssidman as I was unaware it would work on an access table?
Exporting to Excel might be one way now you have the power query for that, but what happens when you have another issue.?
My version of access does not allow multivalued fields and I was under the impression developers leave them well alone.?

So you want to create two new records from record 3 data and one new record from record 5 data?
If so I would use the split function to obtain all data after the first entry.? and append a new record for each?
 
Upvote 0
Welshmgasman,
You can import an Access table into Power Query and modify the table and then either reload it back to Access or publish as an excel report. I have done this on many occaisons especially when I want to Pivot data that I have in an Access Query. It is a quick and easy way to do it.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top