Hello,
I need help with formatting cells for Canadian Postal Codes.
Example: if m9b2t3 is placed in the cell Excel will update the cell to M9B 2T3
Thank you kindly for any help.
rmcc
Hello,
I need help with formatting cells for Canadian Postal Codes.
Example: if m9b2t3 is placed in the cell Excel will update the cell to M9B 2T3
Thank you kindly for any help.
rmcc
this one cannot be achieved with any custom formatting, meaning, you would need to use a helper column for splitting the string into two pieces. another approach would be a VBA macro, which would do the splitting in the background and in which case you would not need a helper column.
method with helper column, put the formula in B1:
or![]()
Please Login or Register to view this content.
or![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
- i.s.z -
CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
All good ideas are courtesy resources from this forum as well as others around the web.
- e.o.m -
I am sorrybut I don't understand where to put the codes
why don't you share an excel spreadsheet with sample data and i will set it up for you?
here is the VBA macro method, in case you are inclined towards an automated solution:
![]()
Please Login or Register to view this content.
Last edited by icestationzbra; 07-23-2012 at 03:07 PM. Reason: attached sample file
i had forgotten to attach a sample file - here it is now.
in column A, type any postal code in any_case and hit enter > see it automatically change to UPPER_CASE with a space inserted between 3rd and 4th characters.
Last edited by icestationzbra; 07-23-2012 at 03:06 PM. Reason: added sample file to the correct post
Hi icestationzbra,
Yes, I will share the sample data.
Thank You very much.
Last edited by Cutter; 07-23-2012 at 04:06 PM. Reason: Removed whole post quote
@rmcc, see my post #5 - i have uploaded a sample file in it with the code embedded. enable macros, follow the directions in that post and test with your sample data directly in that file.
Hi,
Here is the Excel sample data. rmcc-sample-data.xlsx
Thank you kindly.
Hi icestationzbra,
I sent the excel sample file but forgot to add that excel should convert the data when it is enter. I don't want to, at a later date, select he cells then run the macro to update the text. Thank you.
here you go...
enable macros and play with it.
Hi icestationzbra,
I follow your instructions and ran the macro but when i add text to the empty cell it is still not formatting the cells.
Example, if i add m4w3t2 to the sell it stays the same as i entered it. I was hoping the after running the macro, Excel would convert the added data from m4w3t2 to M4W 3T2.
What went wrong?
Thanks
rmcc
i tested the file that i had uploaded, and it works like a charm.
when you open the file, do you see an option that i have highlighted in the attached picture below?
rmcc_847043_23jul12_03.png
once you click on the Options button, it should pop-up another window like the one below:
rmcc_847043_23jul12_04.png
on this one, you have to select Enable Content and click on OK for the macro to work (so, you do not actually RUN the macro; it gets enabled and activated and runs in the background).
have you done all these?
I am using Excel 2007. When I open the file there was nothing as what is in your images.
i am using Excel 2007 too. what Operating System are you on?
---------- Post added at 07:50 PM ---------- Previous post was at 07:46 PM ----------
by the way, i have hit a bug on that file that i had uploaded earlier. i am going to open a thread in the VBA section on this issue.
the code works fine for all columns except for the column in which you have the Data Validation and it flips out completely. so, just wait for a bit.
Hi,
I am using Windows 7 Home Premium.
I saved the file as a new excel file with macros disabled.
I will wait for you.
Thank you.
rmcc, you should save it as a Macro Enabled file for Macros to work...
only when you do that will you get the prompt for enabling macros.
the solution is macro-based, you will need to save the file as a macro-enabled file and enable macros for the solution to work for you.
i have created another thread for the issue with Data Validation:
http://www.excelforum.com/excel-prog...ing-macro.html
Last edited by icestationzbra; 07-23-2012 at 10:25 PM. Reason: link
rmcc,
see the attached file - the macro in it was provided by Jerry Beaucaire on another thread.
download this file as a MACRO ENABLED file. enable macros and then test it out. only text entered in columns A, B, C, D, E and G will be converted to Proper_case by this macro. column H should be handled through Custom Format, which you already have setup.
rmcc, you mentioned that you downloaded the file, but it is not working.
take me step by step through what you did to download the file - and, first of all, did you download the file from here in this thread?
OK, I am starting fresh.
Downloading the file from this thread
Opened the file from this thread and there is a Security Warning: Macros have been disabled
Saved the file as an Excel-Macro Enabled Worksheet
The Security Warning is still there
Clicked on Options then checked Enable this content
Typed some text in the formatted cells and it worked beautiful![]()
Thank You.
I wasn't getting this result before.
Now I go to my file and click on the Developers tab and choose Visual Basic
Visual Basic opens and I see the codes in the file I downloaded from today's thread
Now I am lost...
How do I take those codes and add it to my file?
Thank you kindly for your help.
rmcc
cool - first, and major, step conquered...
if you feel comfortable in sharing your work file with me (devoid of data, of course), i can setup the macro in it for you.
if you want to try it yourself, here is how to do it.
open your work file. determine which is the sheet that has the table for names, address etc. let us say it is Sheet1. now, right-click on the sheet tab where it says Sheet1. one of the options should be View Code, select that. once you select that option, a new window, know as the VB Editor in general parlance, should pop up. that window should look like the following image:
rmcc_847043_24jul12_06.png
the left-side pane should have Sheet1 highlighted and selected (that is the sheet tab you right-clicked on). make very sure there is nothing on the right-side pane. if there is something in there, that is probably code you need, too. so revert here in that case.
now, switch over to this forum thread.
take the following code (highlight all the way from Option Explicit to End Sub and copy):
after you have copied the code above, paste it within the right-side pane, just below where it says General and Declarations. now, your window should look something like this image below:![]()
Please Login or Register to view this content.
rmcc_847043_24jul12_07.png
that's it - click on SAVE, close the window, switch back to your spreadsheet and start plonking data in.
remember, you have to enable macros EVERY TIME you open the file.
I really want to learn how to make the macro work, but still having problems; probably gave you the wrong columns.
Attach is the work file, but I still want to learn how; where do I put in the code which columns Excel should format?
Thanks a lot for your help.
Last edited by Paul; 07-24-2012 at 01:24 PM. Reason: Removed attachment as it may contain private data.
psst see the button top left of code click that then copy
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and now happily retired
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
rmcc,
here you go - as soon as you download this file, let me know and i will delete it from my post. you should also delete your file from your post #21.
EDIT: file deleted.
Last edited by icestationzbra; 07-24-2012 at 01:20 PM. Reason: file deleted
icestationzbra,
file is downloaded
---------- Post added at 01:55 PM ---------- Previous post was at 01:16 PM ----------
icestationzbra
Thank you again for your time, help and persistent.
This file is working great. Also thanks for the advice on deleting the file -I saw where I made the mistake
Have yourself a wonderful day.
Sincerely,
rmcc
rmcc,
moderator's have removed it, so no worries, hopefully.
if your requirement is satisfied, please close the thread as SOLVED.
rmcc,
moderator's have removed it, so no worries, hopefully.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks