bfuchs
asked on
Split Names column into First Last name columns #2
Hi Experts,
This is in reference the the following Q
https://www.experts-exchange.com/questions/29170016/Split-Names-column-into-First-Last-name-columns.html?anchorAnswerId=43013755#a43013755
How to perform a split of names column with mostly being First + Last Name while some are Last + First Name (Indicated by Comma).
Thanks
This is in reference the the following Q
https://www.experts-exchange.com/questions/29170016/Split-Names-column-into-First-Last-name-columns.html?anchorAnswerId=43013755#a43013755
How to perform a split of names column with mostly being First + Last Name while some are Last + First Name (Indicated by Comma).
Thanks
ASKER
Hi,
There is one problem with it, if a first name contains two words, it will push the second to the last name column.
This was addressed by the original thread.
Thanks,
Ben
There is one problem with it, if a first name contains two words, it will push the second to the last name column.
This was addressed by the original thread.
Thanks,
Ben
=CHOOSE(2*(LEN(A1)-LEN(SUB STITUTE(A1 ," ",""))-1)+ISERR(FIND(",",A 1))+1,REPL ACE(A1,1,F IND(",",A1 )+1,""),LE FT(A1,FIND (" ",A1)-1),REPLACE(A1,1,FIND (",",A1)+1 ,""),LEFT( A1,FIND(" ",A1,FIND(" ",A1)+1)-1))
=CHOOSE(2*(LEN(A1)-LEN(SUB STITUTE(A1 ," ",""))-1)+ISERR(FIND(",",A 1))+1,LEFT (A1,FIND(" ,",A1)-1), REPLACE(A1 ,1,FIND(" ",A1),""),LEFT(A1,FIND("," ,A1)-1),RE PLACE(A1,1 ,FIND(" ",A1,FIND(" ",A1)+1),""))
=CHOOSE(2*(LEN(A1)-LEN(SUB
ASKER
Hi,
That's much better, just two issues found.
1- If column only has one word it gives an error, should go under first name
2- If column has more than 3 words it gives an error, should all but the last go under first name and last word under last name.
Thanks,
Ben
That's much better, just two issues found.
1- If column only has one word it gives an error, should go under first name
2- If column has more than 3 words it gives an error, should all but the last go under first name and last word under last name.
Thanks,
Ben
If its Excel then remove the tag about Microsoft Access
If you work in Access the Split Command should serve you just fine...probably you could make a table with First Names and if the result of the split (Reversed Name/FirstName) is not "contained" then it will take the results in Reverse.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Put your list in the Original Data tab table, then refresh the table in Transformed tab. See if this works for you.
EE.xlsx
EE.xlsx
Oops... Forgot the last step.
EE.xlsx
EE.xlsx
ASKER
@Tom,
Tried your latest, didn't seem to do anything, perhaps I need instructions...
@John,
Thanks Sakib for great job!
Tried your latest, didn't seem to do anything, perhaps I need instructions...
@John,
If its Excel then remove the tag about Microsoft AccessFile could have been linked to Access and create those in logic in either Query itself like Saqib did, or via UDF's...
Thanks Sakib for great job!
bfuchs, the tool I showed you if rather simple to update. I just copied the names I had in the previous file (Original Tab), added them to the bottom and went to the Transformed Tab and right-clicked in the table and selected "Refresh". See attached. The query runs and updates for the new data. What version of Excel are you using? That might be the issue. I would think you could update the query if you had Excel 2016 Pro or later. Maybe I don't have a grasp of share-ability for the tool. Anyway, you might want to look into it, it is good for many things. - Tom
EE-5-2.xlsx
EE-5-2.xlsx
ASKER
Hi,
Thanks,
Ben
Untitled.png
and went to the Transformed Tab and right-clicked in the table and selected "Refresh"Dont see that option, see attached.
you had Excel 2016 Pro or laterI do have Office365.
Thanks,
Ben
Untitled.png
See if you can go to Data > Queries, and that should bring up a query screen on the right. Does that work?
Data>Show Queries. Does it show a query on the right?
ASKER
@ Tom,
Now I saw it under Connections and queries.
Can you explain more on how this works, where do I see the SQL?
How can i modify that if needed, and how you copy rows from there to another source?
Thanks,
Ben
Now I saw it under Connections and queries.
Can you explain more on how this works, where do I see the SQL?
How can i modify that if needed, and how you copy rows from there to another source?
Thanks,
Ben
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The Power Query (Get and Transform is the name now) records the steps of transformation in a language called M. The code can be seen within the formula bar or by going to (don't exactly have the path) View>Advanced Editor. There is quite a few videos on the internet that can introduce you to Power Query.
ASKER
Thank you Tom!
=IFERROR(LEFT(A1,FIND(",",