# Rearrange the contents of a cell using a formula

Dear Experts

In excel I need to rearrange the contents of a cell using a formula ... Each cell has 3 bits of information

job, company, dates (i.e. CEO, Microsoft, 2015-2018)

These are all all separated by ", " (Comma space) & I need the result to read

company, job, dates (i.e. Microsoft, CEO, 2015-2018)

Can anyone help?
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EE Topic Advisor, Independant Technology ProfessionalCommented:
It would be a combination of MID functions and FINDs to locate the ", " text.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Excel & VBA ExpertCommented:
Assuming your string is in A2, then try this...
In B2
``````=TRIM(MID(SUBSTITUTE(", "&\$A2,", ",REPT(" ",LEN(\$A2))),COLUMNS(\$B2:B2)*LEN(\$A2),LEN(\$A2)))
``````
and then copy to right.
0
Author Commented:
That gave me the lead to how to solve it, so thanks for that - in the end the formula was ...

=TRIM(MID(SUBSTITUTE(","&AB2,",",REPT(" ",LEN(AB2))),LEN(AB2)*(LEN(AB2)-LEN(SUBSTITUTE(AB2,",",""))),LEN(AB2))) &" - "&LEFT(AB2,FIND(",",AB2,1)-1)&IF(RIGHT(AB2,1)="-"," ("&RIGHT(AB2,5)&"Present"," ("&RIGHT(AB2,9))&")"
0
Author Commented:
That gave me the lead to how to solve it, so thanks for that - in the end the formula was ...

=TRIM(MID(SUBSTITUTE(","&AB2,",",REPT(" ",LEN(AB2))),LEN(AB2)*(LEN(AB2)-LEN(SUBSTITUTE(AB2,",",""))),LEN(AB2))) &" - "&LEFT(AB2,FIND(",",AB2,1)-1)&IF(RIGHT(AB2,1)="-"," ("&RIGHT(AB2,5)&"Present"," ("&RIGHT(AB2,9))&")"
0
Author Commented:
That gave me the lead to how to solve it, so thanks for that - in the end the formula was ...

=TRIM(MID(SUBSTITUTE(","&AB2,",",REPT(" ",LEN(AB2))),LEN(AB2)*(LEN(AB2)-LEN(SUBSTITUTE(AB2,",",""))),LEN(AB2))) &" - "&LEFT(AB2,FIND(",",AB2,1)-1)&IF(RIGHT(AB2,1)="-"," ("&RIGHT(AB2,5)&"Present"," ("&RIGHT(AB2,9))&")"
0
Author Commented:
That gave me the lead to how to solve it, so thanks for that - in the end the formula was ...

=TRIM(MID(SUBSTITUTE(","&AB2,",",REPT(" ",LEN(AB2))),LEN(AB2)*(LEN(AB2)-LEN(SUBSTITUTE(AB2,",",""))),LEN(AB2))) &" - "&LEFT(AB2,FIND(",",AB2,1)-1)&IF(RIGHT(AB2,1)="-"," ("&RIGHT(AB2,5)&"Present"," ("&RIGHT(AB2,9))&")"
0
Excel & VBA ExpertCommented:
Sorry to say but you should learn how to ask a question and accept an answer.
We provide solution based on the description and sample data you provide and the formula I suggested produced the desired output based on the sample data you provided in the description.

0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.