Hi!
I plan to import an Excel spreadsheet that is not normalized. I am wondering how I should go about splitting a field.
My Excel sheet has a column for Advocates. A case can have either one or two advocates. If a client has two advocates, they are both listed in the same column. The names are separated by a slash, like this:
Advocate(s):
Smith
Jones
Smith/Jones
Smith/Roberts
What is the best way to go about normalizing this data? So far, I am planning to:
1. Split Advocate information into two fields, Advocate1 and Advocate2.
2. Combine the two fields into one, Advocate. This would be different from the original advocate field, because each cell (“control”?) would contain only one Advocate.
3. Create a table with CaseNumber (the primary key for cases) and each case’s corresponding Advocate.
Does that sound reasonable?
Right now I’m stuck on Step 1. I don’t know how to use InStr() in the code that would split Advocate into two fields. After studying posts on parsing, here is my best shot at it:
Code:
UPDATE import_table
SET Advocate1=Left$(Advocate, instr(Advocate, “/”))
SET Advocate2=Right$(Advocate, instr(Advocate, “/”));
Of course, I’m getting error messages...(“syntax error: missing operator”)
If anyone could help me fix the code, I would really appreciate it! Any advice on the other steps in normalization would also be quite helpful.
Thanks, Tek-Tips folks!
sarajini