Solved

Reformat a field in Excel

Posted on 2012-03-31
4
204 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
  • 2
4 Comments
 
LVL 92

Expert Comment

by:John Hurst
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 41

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 41

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now