Solved

Reformat a field in Excel

Posted on 2012-03-31
4
208 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 94

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 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

749 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