+ Reply to Thread
Results 1 to 5 of 5

2 digit Pincode to be corrected to 6 digits with a standard prefix in addresses in excel

  1. #1
    Registered User
    Join Date
    12-27-2015
    Location
    Mumbai
    MS-Off Ver
    2010
    Posts
    3

    2 digit Pincode to be corrected to 6 digits with a standard prefix in addresses in excel

    Hi, I have addresses of customers to correct from Mumbai-42 or Mumbai-93 i.e. Mumbai-xx to be changed to Mumbai 400042 or Mumbai 400093 i.e. Mumbai 4000xx
    Please note that some pincodes are correctly given in the addresses. So existing 6 digit pin codes should not get altered.
    Is there a formula to apply to this correction from 2 digit with 6 digists with a standard suffix 4000 if the preceding city name is Mumbai followed by a dash and a 2 digit number



    Thanks for your help

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: 2 digit Pincode to be corrected to 6 digits with a standard prefix in addresses in exc

    Try

    =SUBSTITUTE(SUBSTITUTE(A1,"-"," 4000"),40004000,4000)
    Last edited by Ace_XL; 12-27-2015 at 07:09 AM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    12-27-2015
    Location
    Mumbai
    MS-Off Ver
    2010
    Posts
    3

    Re: 2 digit Pincode to be corrected to 6 digits with a standard prefix in addresses in exc

    Hi Ace_XL, Thanks. Your formula works if it is Mumbai-42 and makes it Mumbai 400042. But if the already correct codes such as Mumbai-400042 is becoming Mumbai 4000400042
    Can we restrict the formula to only where 2 digits are present after Mumbai-.
    Hope I have been able to explain clearly

  4. #4
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: 2 digit Pincode to be corrected to 6 digits with a standard prefix in addresses in exc

    Try just the inside substitute by itself maybe?

    =SUBSTITUTE(A1,"-"," 4000")

    That just replaces the - with a space and 4000

    Edit:
    If there are codes that do have a "-" then maybe:
    =IF(LEFT(A1,6)="Mumbai",SUBSTITUTE(A1,"-"," 4000"),A1)
    Last edited by Beamernsw; 12-27-2015 at 07:24 AM.

  5. #5
    Registered User
    Join Date
    12-27-2015
    Location
    Mumbai
    MS-Off Ver
    2010
    Posts
    3

    Re: 2 digit Pincode to be corrected to 6 digits with a standard prefix in addresses in exc

    Perfect!! Thanks, Ace_XL.

    This is great!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 09-26-2015, 04:19 PM
  2. Replies: 5
    Last Post: 06-04-2015, 03:25 PM
  3. [SOLVED] Addresses - truncate 11 digit zip codes and leave 5 digit zip codes
    By landisf in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-25-2013, 11:15 PM
  4. Add Standard Prefix To Cells
    By zulhfreelancer in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 06-09-2013, 07:11 AM
  5. How to add 2 digits to the end of a four digit number
    By Gordond54 in forum Excel General
    Replies: 6
    Last Post: 01-01-2013, 04:19 PM
  6. [SOLVED] Getting the first 3 digits out of 6 digit cells?
    By Darla in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-15-2005, 11:05 AM
  7. [SOLVED] Why is Excel changing the last 2 digits of a 17 digit num to 00.
    By Allie in forum Excel General
    Replies: 2
    Last Post: 07-29-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1