How to create a macro that removes unnecessary digits in zip code?
Our take
Hello all! I format lots of files per day and would like to create a macro that automates most of it. I'm aware that using "Text to Columns" with a specific fixed width and then not importing the second half works to remove the extra four digits, but can't figure out how I would go about coding that. The recording process does not work, unfortunately.
For context, I've included an example of what the zips might look like- all zips should end up in a 5 digit format, with leading zeroes if the zip is only 4 digits. The zip codes will always be in the N column, and the left and right columns also have data in them. As you can see, nine digit zip codes may be in 00000-0000 or 000000000 or 00000 0000. I've tried reformatting all zips to be 00000-0000 with the zeroes trailing for 5 digit zips, but I cant seem to use the delimited option in text to columns to get rid of the extra ones either. Any advice appreciated!
[link] [comments]
Read on the original site
Open the publisher's page for the full experience
Related Articles
- Can I split columns by number of characters/ digits?I have a list of addresses for a mailing I need to complete. The zip codes column is supposed to read #####-####, but for whatever reason, the hyphen was lost and I'm left with all 9 digits straight. Is there a function I can use to either separate the columns, add the hyphen after the 5th digit, or even just get rid of the last 4 digits altogether? I just need something I can work with for a mail merge, without manually having to change the couple hundred entries. The last 4 digits are nice, but not necessary. I tried using text to columns but since there is no delimitator, I didn't get far. Any advice is appreciated! TIA Excel Version Office 365 version 2603; Build 19822.20114 Excel Environment: desktop, Windows Excel Language English Your Knowledge Level: Formerly intermediate/advanced, but its been almost a decade since it was a daily work task, I'm extremely rusty https://preview.redd.it/urr8yjwwv2sg1.png?width=1186&format=png&auto=webp&s=78e94874c3747545c707380206da8c93931d67b5 submitted by /u/CCCrazyC [link] [comments]
- Need macro advice! Saving longer numbers as strings to show all the charactersDesktop, Excel 365 Build 19929.20106 Click-to-Run, Beginner We have a macro that generates new files using a list of data. Sometimes that data is completely numerical with over 15 digits. Excel keeps reformatting these numerical entries using scientific notation, which screws up the output files. Right now I have to manually check the output files and reformat the affected ones so that all then hidden characters are shown. Can someone please advise on how I can update the macro to automatically convert these numbers into strings that show all the characters? The data is of variable length, but I'm pretty sure it's always under 20 characters. This problem only affects one cell of the output file. Everything else is generated without issue. It's basically the problem of "how do I make Excel macro copy-paste the entire FedEx tracking number correctly" but the data isn't consistently 16 characters and is frequently alphanumeric. EDIT: I'm open to even stupid and booleg solutions like "add a hidden text character before transferring the data" to force this to work. The output files are basically just printables. I just don't know anything about macros and do not have time to learn. submitted by /u/Umklopp [link] [comments]
- How to merge repeating zip codes with counts into single count for zip codeI have a file thats a list of customers by zip code with a count, some were extended zip and some were short 5 digits with a count. I made each row a short 5 digit zip, but is there a simple way I can get a combined count for each zip that repeats. I could kinda manually do it by zip but that would take a really long time. Im on excel for web from Microsoft 365 submitted by /u/jmomo99999997 [link] [comments]