Solved

Reformat a field in Excel

Posted on 2012-03-31
4
211 Views
Last Modified: 2012-04-09
Hi, In Excel, how can I make  BROOKS, GARTH to GARTH BROOKS magically?
0
Comment
Question by:Computer Guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Experienced Member
ID: 37791139
Assuming you can create a sheet with just this information in it (say a column created as you showed above), save the sheet as a .CSV file and the inport it. The CSV import allows you to define colums by the comma, which is what you want here. Then copy the columns back to your main sheet.

.... Thinkpads_User
0
 
LVL 42

Expert Comment

by:dlmille
ID: 37791285
if A2 has the lastname,firstname, you can put this in B2 and copy down:

[B2] = TRIM(RIGHT(A2,LEN(A2)-FIND(",",A2))) & " " &LEFT(A2,FIND(",",A2)-1)

This assumes that you may or may not have a space after the comma.

See attached.

Dave
example-r1.xls
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 37795297
Hi,

Thanks, I tried it and it works fine on the ones that are setup that way.

Now when I say have ALABAMA, this shows up in the field: #VALUE!

How can I do this automatically without having to change it manually?

Thanks!
0
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 37814380
Sorry - for some reason I didn't see your response until now.  I don't get that error in my test, however, I did add some error checking to the formula.  If you get an error in future, just put the text in a cell and upload this sample worksheet so I can diagnose, though hopefully we're now in better shape.

[B2] = IF(ISERROR(FIND(",",A2)),A2,TRIM(TRIM(RIGHT(A2,LEN(A2)-FIND(",",A2))) & " " &TRIM(LEFT(A2,FIND(",",A2)-1))))

And copy down.

See attached.

Dave
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question