Click here to Skip to main content
15,887,027 members
Articles / Productivity Apps and Services / Microsoft Office / Microsoft Excel

String Concatention In Excel Formulae

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
23 Dec 2009CPOL 11.6K   2   2
How to do string concatenation in Excel formulae

A little known but shockingly useful feature of Excel is that you can stick strings together using the & operator in formulae.

My wife asked me how to make a column which has only the month and year from a date column in it. For example:

12/06/2009 -> 6/2009

One might think this was rather challenging and try and find some complex mathematical approach. However, the solution is stupidly simple:

If you're date is in A1 then:
=month(A1) & "/" & year(A1)

This works because the & concatenates (sticks together) strings. The formula considers month(A1), "/" and year(A1) all to be strings and just makes them into one big string.

Once you get the idea, there are many other things which can be done this easy way rather than having to put in too much work!

Also posted on 

This article was originally posted at http://nerds-central.blogspot.com/feeds/posts/default

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United Kingdom United Kingdom
I am now a Software Systems Developer - Senior Principal at Micro Focus Plc. I am honoured to work in a team developing new compiler and runtime technology for Micro Focus.

My past includes a Ph.D. in computational quantum mechanics, software consultancy and several/various software development and architecture positions.

For more - see

blog: http://nerds-central.blogspot.com

twitter: http://twitter.com/alexturner

Comments and Discussions

 
GeneralNot exactly earth shattering Pin
flector23-Dec-09 6:17
flector23-Dec-09 6:17 
GeneralRe: Not exactly earth shattering Pin
alex turner23-Dec-09 22:52
alex turner23-Dec-09 22:52 
I agree - not exactly earth shattering! I am still playing with what level to pick for items from my blog to be included on code project. It is all a learning curve.

Having said that - your reply is great - so information got shared and knowledge passed around Smile | :)

Thanks - AJ

www.nerds-central.com - welcomes all nerds Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.