Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Formatting Canadian Postal Codes.
by Allen Wyatt
(last updated April 21, 2021)
In Canada, postal codes consist of six characters with a space in the middle: a letter, a number, a letter, a space, a number, a letter, and a final number. Thus, A1B 2C3 is a properly formatted postal code. If you are retrieving postal codes from an external database, they might not have the required space in the middle. Excel makes it easy to add such a space.
Let's assume that the improperly formatted postal codes are in column C. In column D you could use a formula such as the following:
=LEFT(C12,3) & " " & RIGHT(C12,3)
This formula uses string-manipulation functions to place a space in between the first and last three characters. Thus, if C12 contained A1B2C3, then the cell with this formula would display A1B 2C3.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11167) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Formatting Canadian Postal Codes.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
One of the staples of high school algebra classes is the quadratic equation. If you need to solve such equations in ...Discover More
When doing a systematic search for rescue purposes, it isn't unusual to implement what is termed an "expanding square." ...Discover More
Do you ever have a need to return just a few digits out of a number? This tip shows different formulas you can use to ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.