Tom Crowfoot
asked on
Split Field data into Table Columns
Dear Experts
I need to write a piece of code which splits out the data contained in the field “Contents” and either creates a new table with the data split out or appends the data to an existing table (TblOutput) in the relevant field
(Hopefully this makes sense - if it was in Excel this would be a Data>Text to Column action)
The data in the field “Contents” is separated by a “~” and looks like this:
Weekly Update~example@hotmail.com ~Ima Example~Example Co~Head of Exampling.
The Table (TblOutput) has 5 fields:
List
Email
Name
Firm
Role
The data need to get mapped as follows
“Content” Field Name in TblOutput
1st Section = List
2nd Section = Email
3rd Section = Name
4th Section = Firm
5th Section = Role
And should end up looking like this in the table:
Can anybody Help?
I need to write a piece of code which splits out the data contained in the field “Contents” and either creates a new table with the data split out or appends the data to an existing table (TblOutput) in the relevant field
(Hopefully this makes sense - if it was in Excel this would be a Data>Text to Column action)
The data in the field “Contents” is separated by a “~” and looks like this:
Weekly Update~example@hotmail.com
The Table (TblOutput) has 5 fields:
List
Name
Firm
Role
The data need to get mapped as follows
“Content” Field Name in TblOutput
1st Section = List
2nd Section = Email
3rd Section = Name
4th Section = Firm
5th Section = Role
And should end up looking like this in the table:
Can anybody Help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Pritamdutt,
Thanks for this, just so i'm on the right track your Mid([full_name],InstrRev([ full_name] ," ") + 1) does the following ... reading left to right across the field, the InstrRev bit looks for the seperator (in your case a space, in mine a ~) & the mid piece takes everything after the seperator. If that right then any ideas how I can get the it to look at the 2nd, 3rd etc seperators?
Thanks for this, just so i'm on the right track your Mid([full_name],InstrRev([
@correlate your question has brought me to a conclusion to use the following method:
Press ALT+F11 and
1. Create a VBA "Split" function the way it has been suggested by fyed
2. Make a call to function in your query already suggested by fyed
Press ALT+F11 and
1. Create a VBA "Split" function the way it has been suggested by fyed
2. Make a call to function in your query already suggested by fyed
ASKER
oops, don't know how I missed that comma, should beL
fnParse([Content], 3, "~")
fnParse([Content], 3, "~")
and yes, if you change the default in the function you can drop the last parameter from each of the function calls.
ASKER
Absolute genius - thank you very much
You're welcome
stringcheck - string being searched
stringmatch - string that we're looking for
string - string to work with
start - where to start
So far example I have to split full name into first name and last name I would do the following to extract the last name
Mid([full_name],InstrRev([