+ Reply to Thread
Results 1 to 17 of 17

finding canadian postal codes with SEARCH function (using wildcards)

  1. #1
    Registered User
    Join Date
    03-02-2017
    Location
    Taiwan
    MS-Off Ver
    Excel 2010
    Posts
    21

    Question finding canadian postal codes with SEARCH function (using wildcards)

    Hello there,

    Is there a way to check if cells in a column contain a Canadian postal code, format X0X 0X0 (letter, digit, letter, space, digit, letter, digit) by using the SEARCH function?

    Thank you!

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    VLOOKUP regardless of the format.

    https://support.office.com/en-us/art...8-93a18ad188a1
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-02-2017
    Location
    Taiwan
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Sorry, but I think you didn't get me ... :/ What I want to get this second column from the first column ("true" if a valid postal code is detected within the cell):

    dajdY7U 8U9 true
    dadsJ6G 4F6%?&*? true
    false
    74829 false
    H6j778 false
    k8v 4f9 true
    Last edited by Stevee829; 04-13-2017 at 05:35 AM.

  4. #4
    Registered User
    Join Date
    03-02-2017
    Location
    Taiwan
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    My question felt into oblivion I believe...

  5. #5
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Hi,

    can you confirm you using Excel 2007?

    Regards
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  6. #6
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Hi,

    a brute-force attack

    Please Login or Register  to view this content.


    Hope it helps
    Attached Files Attached Files
    Last edited by canapone; 04-13-2017 at 10:50 AM. Reason: doubled segment in the formula: same outputs+cosmetics

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    .
    .
    The following seems to work ..
    Paste this into a Routine Module:

    Please Login or Register  to view this content.
    Then, let's say all your data is in Col A ... Paste this formula in B1 and copy down:
    Please Login or Register  to view this content.
    This will give you either TRUE or FALSE for a match.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Try:

    =ISNUMBER(MATCH(7,MMULT(0+(ABS(77.5-{0,25,0,45.5,25,0,25}-CODE(MID(MID(UPPER(A1),ROW(INDEX(A:A,1):INDEX(A:A,LEN(A1)-6)),7),{1,2,3,4,5,6,7},1)))<{13,5,13,1,5,13,5}),{1;1;1;1;1;1;1}),0))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  9. #9
    Registered User
    Join Date
    03-02-2017
    Location
    Taiwan
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Quote Originally Posted by canapone View Post
    Hi,

    can you confirm you using Excel 2007?

    Regards
    Sorry, it's 2010, you're right! Does it change something to the formula?

  10. #10
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Hi,

    No, I was considering to use AGGREGATE (Excel 2010) : same outputs

    Logit's Vba code or XOR LX's formula are by far more elegant.

    Regards

  11. #11
    Registered User
    Join Date
    03-02-2017
    Location
    Taiwan
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    thanks all!

  12. #12
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Hi,

    thanks for providing kind feedback.

    A last doubt: if your strings could contain more than one space, formula would need to be reviewed...

    Regards
    Last edited by canapone; 04-13-2017 at 11:42 AM.

  13. #13
    Registered User
    Join Date
    03-02-2017
    Location
    Taiwan
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Quote Originally Posted by canapone View Post
    if your strings could contain more than one space, formula would need to be reviewed...
    And if it contains no space at all, I guess it would also need to be reviewed (not for now)

  14. #14
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Hi,

    thanks.

    I'll stay tuned in...

  15. #15
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Logit's Vba code or XOR LX's formula are by far more elegant.
    Thank you !

  16. #16
    Forum Contributor
    Join Date
    12-13-2013
    Location
    Calgary,AB,Canada
    MS-Off Ver
    2016,O365
    Posts
    236

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    Assume Column A is original Text content with/without Postcode and with/without space
    C1=SUM(N((CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5))),1))>64)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+1,1))<65)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+2,1))>64)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+3,1))<65)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+4,1))>64)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+5,1))<65)=6))>0 then CTRL+SHT+Enter , copy down

  17. #17
    Forum Contributor
    Join Date
    12-13-2013
    Location
    Calgary,AB,Canada
    MS-Off Ver
    2016,O365
    Posts
    236

    Re: finding canadian postal codes with SEARCH function (using wildcards)

    if you want to extract postcode (if has),
    D1 =IFERROR(MID(SUBSTITUTE(A1," ",),
    IF(SUM(N((CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5))),1))>64)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+1,1))<65)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+2,1))>64)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+3,1))<65)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+4,1))>64)+
    (CODE(MID(SUBSTITUTE(A1," ",),ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))+5,1))<65)=6))>0,MIN(ROW(INDIRECT("1:"&(LEN(SUBSTITUTE(A1," ",))-5)))),"/"),6),"")

    then CTRL+SHT+Enter , copy down

+ 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. Canadian postal code format
    By SLN in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-15-2016, 08:25 AM
  2. Canadian Postal Code format
    By nmurphy2 in forum Office 365
    Replies: 4
    Last Post: 10-02-2014, 01:01 AM
  3. [SOLVED] Help With Canadian Postal Code In Userform
    By eddyrcabrera79 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-04-2013, 08:16 PM
  4. Distance between Canadian Postal Codes
    By lesleyhollett in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-17-2013, 10:47 AM
  5. [SOLVED] Format for Canadian Postal Codes
    By rmcc in forum Excel General
    Replies: 25
    Last Post: 07-24-2012, 02:04 PM
  6. Adding Canadian Postal Codes to Excel 07
    By bandaid8 in forum Excel General
    Replies: 5
    Last Post: 05-22-2009, 01:58 PM
  7. [SOLVED] Using excel 2003 cannot see Canadian Postal Codes
    By PW in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-08-2005, 03:25 PM

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