Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

Saturday, August 15, 2009

Create a Column in Excel with Leading 0s

To create a column in Excel with leading 0s given a column A with values 0,1,..., and 12 character string to create, use this formula on the target column:


= RIGHT("000000000000" & A1,12)

The result will be 000000000000,000000000001,...
Then just use the copy, paste special as values technique mentioned earlier.

Reference: http://www.koozie.org/2004/11/excel_leading_z.html

Concatenate two Excel Columns with a Character or String

To concatenate (or join) two columns A2 and B2 into C2 with a hypen (in this case), use this formula in C2:

=A2&"-"&B2

Then copy the results down the column with click and drag downwards to duplicate the formula on the cell. Finally, copy column C and paste special into the target column as values only.

Reference: http://www.pcmag.com/article2/0,2817,33100,00.asp