Replace Delimited Field with New Values from Table

elfmajesty

New Member
Joined
Sep 28, 2004
Messages
39
Good afternoon, all. I am struggling with "find and replace" problem that I thought I could do in Access.

I have a table of data of two fields where one field has data delimited by a semicolon. I have another table of "cross-ref" numbers. I need to replace the original delimited data with the cross-ref numbers.

TABLE001
Field1 - ID Field2 - DelimitedData

TEST001 John;Susan;Mary
TEST002 Susan
TEST003 John;Mary
TEST004 John;Susan


TABLE002-CrossRef
Field001 Field003

John 100
Susan 200
Mary 300

I need my result to be
TEST001 100;200;300
TEST002 200
TEST003 100;300
TEST004 100;200

Any way I can do this using Access with the two tables I have?

Thank you in advance,
Elf
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I can only see a solution that involves code because there is no link between an element of the delimited data (which is in effect, an array) and the corresponding field in the other table. I'm thinking the code would have to assign the field data to an array (John;Susan;Mary) then split it and step through the elements. Then run a sql statement (or simply do a DLookup) on the other table by using each array element as a key and retrieve the corresponding value from field 003. Once you have that, based on your post I'd guess that you'd run an update query for each array element. I presume you realiize that the target table has to have a value in order to perform an update on it. Otherwise, you'd probably have to update a DAO recordset. Hope that makes sense.
 
Last edited:
Upvote 0
Thanks, Micron. I appreciate the reply. Yes, pretty complicated. I'm looking into attempting to write formula in Excel with VLookup and either Substitute or Replace in conjunction. Will try to update here if I come up with anything brilliant. :)
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,250
Members
451,757
Latest member
iours

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