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
Solved

Reformat a field in Excel

Posted on 2012-03-31
4
207 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 93

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

837 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