English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Im trying to write a macro in order to move information from column a to b in excel. I have last names of people followed by first names in column a and am wondering if i can move the first name to column b. i then need it to delete the comma that separated the first and last names?

2007-11-05 13:56:34 · 3 answers · asked by Holly J 1 in Computers & Internet Software

3 answers

Assuming I'm at data is at Column A1, here's the code to column B1:
=RIGHT(A1,LEN(A1)-SEARCH(",",A1,1))

Note: You need the "=" sign to make it as formula and no space in it.
Example data at A1 = lastname,firstname
then using the formula at B1 it will display firstname.
If there is a space like lastname,_firstname then formula changes to: =RIGHT(A1,LEN(A1)-SEARCH(",",A1,1)-1)

2007-11-05 14:15:43 · answer #1 · answered by Billgate 2 · 0 0

I'd recommend using the Text to Columns feature in Excel. Add a blank column to the right of the column with the names. Then select the column with the names. Then go to:

Data > Text to Columns...

Then select Delimited and click the Next button.

In the Delimiters group, make sure that only Comma is checked, then click the Finish button.

Then you should be done and the comma should even be removed.

If you want to write a macro that will do the same thing, just turn on the Macro Recorder by going to:

Tools > Macro > Record New Macro

Start the recorder before you start separating the data. Then when you are done click the little blue square (stop button) to stop recording with the macro recorder. If you ever want to do the same thing in that column all you should have to do is run the macro.

2007-11-06 00:43:29 · answer #2 · answered by devilishblueyes 7 · 0 0

You do the action as favourite yet you checklist the macro on an identical time as you're doing it. in case you're pre 2007, as much as approaches, Macro, checklist New macro, supply it a recognition and that i recommend shortcut keys then do your inputting and once you have complete click onthe end button on the macro toolbar that would have regarded. Then in destiny to run the macro use the shortcut keys you assigned or you may draw a button then applicable button of mouse on the button all the way down to assign macro and assign the macro to it so as that throughout the time of destiny it is in trouble-free terms push-button. in case you're 2007, change to Developer menu tab and click on recordmacro button in first group of icons on the ribbon.

2016-11-10 09:55:44 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers