Adding Spaces into a column

snoopsterg

New Member
Joined
Sep 27, 2006
Messages
6
Guys,

You will probably know this and maybe think its easy, but i just cant think how to do this.

I have a column with sequential numbers twelve digits long, what i need is to either add a space after each 2 digits OR i need to move each set of 2 digits to its own column.

Am i just a bungling idiot or is this as difficult as i am making it for myself


Cheers for the help

Steve
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi, snoopsterg
Welcome to the Board !!!!!
move each set of 2 digits to its own column
see menu DATA / Text To Columns

in first box select option "fixed width" (don't know if this is correct english)
from there you can follow the instructions

kind regards,
Erik
 

JamieDuncan

Board Regular
Joined
Aug 23, 2006
Messages
132
You could use these formulae in seperate cells

=MID(A1,1,2)
=MID(A1,3,2)
=MID(A1,5,2)
=MID(A1,7,2)
=MID(A1,9,2)
=MID(A1,11,2)

=MID('Cell containing 12 digits','starting digit','number of digits to take')

You could then concatenate the cells back together with spaces between.
 

snoopsterg

New Member
Joined
Sep 27, 2006
Messages
6
Thanks, will try that but it looks good, never thought of that simple is always best, and people like to call me simple


Steve
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832

ADVERTISEMENT

Hi, Jamie,

if you want to concatenate them again, you could use a single formula
Code:
=MID(A1,1,2)&" "&MID(A1,3,2)&" "&MID(A1,5,2)&" "&MID(A1,7,2)&" "&MID(A1,9,2)&" "&MID(A1,11,2)
 

snoopsterg

New Member
Joined
Sep 27, 2006
Messages
6
Thanks for the reply both of you,

Both ways work except the first two columns that have got 01 and 03 in them, they both lose 0.

I have at the moment column A = 010312213041

when i use the either the text to columns or the =MID formula i have a problem to overcome.

with Text to columns i get

A B C D E F
1 3 12 21 30 41

so when i concatenate to add the spaces it misses 0 from 01 and the 0 from 03.

what i am doing is a mailshot with sequential lottery numbers for a draw so needs to be formatted with the zero
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

the "straight" option to get the zeros is to "follow the instructions" in the Text To Columns Dialog: in the last box there is an option "datatype per column"
choose "Text"

best regards,
Erik
 

Forum statistics

Threads
1,140,944
Messages
5,703,312
Members
421,290
Latest member
james90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top