+ Reply to Thread
Results 1 to 21 of 21

Wildcards but numbers only

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Cool Wildcards but numbers only

    Hi guys,

    I do not want VBA code, I need a function in my worksheet.

    I have this code so far:
    Please Login or Register  to view this content.
    I need to find the occurances of *** within Column B.
    where * = [0-9] (Any number between 0 and 9 but no other characters)

    eg, if Cell B4 = "Something235MoreText" I would need a formula to return 9
    eg, if Cell B5 = "Something!35MoreText" I would need a formula not to return anything.

    Thanks,
    Jimmy
    Thanks,

    JimmyWilliams

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Wildcards but numbers only

    I dont understand

    Based on sample 1, you to find any numbers within the 1st 9 characters?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Wildcards but numbers only

    Use Flash fill to extract the numbers in a helper column. Then in the formula column
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and fill down.
    Dave

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Wildcards but numbers only

    Try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    Quote Originally Posted by FlameRetired View Post
    Use Flash fill to extract the numbers in a helper column. Then in the formula column
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and fill down.
    Nope, doesn't work.

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,913

    Re: Wildcards but numbers only

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  7. #7
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    Quote Originally Posted by FDibbins View Post
    I dont understand
    Based on sample 1, you to find any numbers within the 1st 9 characters?
    Sorry I haven't made myself clear.
    This is what my current function does:
    Please Login or Register  to view this content.
    If the Cell contains: "something120awduh" and YYY = 1. Then it returns the number 10. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "s1me798awduh" and YYY = 1. Then it returns the number 5. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "s12eth026awduh" and YYY = 1. Then it returns the number 7. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "somethi1204awduh" and YYY = 1. Then it returns the number 8. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "something120awduh" and YYY = 1. Then it returns the number 10. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "something120awduh" and YYY = 2. Then it returns the number 11. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "so233hi204awduh" and YYY = 2. Then it returns the number 8. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "678i204awduh" and YYY = 2. Then it returns the number 5. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "678i20434awduh" and YYY = 1. Then it returns the number 1. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "678i20434awduh" and YYY = 2. Then it returns the number 5. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "678i20434awduh" and YYY = 3. Then it returns the number 6. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)
    If the Cell contains: "678i20434awduh" and YYY = 4. Then it returns the number 7. As this is where the position of the YYYth occurrence of *** Occurs ( where *** is any number between 1 and 9)

    I have attached a spreadsheet below with this information in it.
    Last edited by JimmyWilliams; 02-07-2018 at 01:04 AM.

  8. #8
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    This code:
    Please Login or Register  to view this content.
    Would be able to solve it, If excel had a character that represented any number between 1 and 9.

  9. #9
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    example of what i am looking for.xlsx

    Attached is examples of what should happen.

    =FIND(CHAR(1),SUBSTITUTE(A1,"XXX",CHAR(1),YYY)) can only find a particular number that I plug into XXX. I need it to work for any possible number XXX

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,913

    Re: Wildcards but numbers only

    Try below array formula

    =IFERROR(SMALL(IF(ISNUMBER(MID(SUBSTITUTE(C2," ","^"),ROW(INDIRECT("1:"&LEN(C2)-2)),3)+0),ROW(INDIRECT("1:"&LEN(C2)-2))),1),"")
    the colored one is YYY = 4 change is as per your need


    ..confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  11. #11
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Wildcards but numbers only

    Or try this regular formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where A2 is YYY and B2 is the string.

    See the file
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    Ok we're getting closer. but let me try again once more.

    Let X represent any number [1-9]
    Let C represent any letter [A-Z]
    Let * represent any letter or Number [A-Z, 1-9]
    Let all other letters of the alphabet stay the same.
    Let all other symbols stay the say


    I want to be able to find the first, Second, Third, fourth...(etc) occurrence of:

    of any length of substring make up of X, C or * in any order.

    Eg
    1st, C*X
    100th, **
    23rd, X
    87th, CXCXCXCSomethingXCXCX**
    2nd, *XCething
    4th, $
    3rd, *omethCng (%^

    I'll keep playing around with it, but hopefully you get what I'm looking for.
    Thanks so far guys.
    Last edited by JimmyWilliams; 02-07-2018 at 07:42 PM.

  13. #13
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    Attachment 560152

    Hi Jose

    I like your formula. I can see how it could work for any digits of any length. but I am wondering about finding substrings with wildcard-digits within the substring.
    It's getting closer!


    thanks,
    Jimmy.

  14. #14
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    *Bumping*
    Still an active problem.

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Wildcards but numbers only

    Jimmy, it doesnt look like that attachment in post 13 came through?

  16. #16
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Cool Re: Wildcards but numbers only

    Hi guys,

    I realize my original question was answered, (Thanks!)
    but this very much related, and related to wildcards and searching in strings and is actually what I need.


    I'm looking for a function where I can search for sub-strings within other strings; search inputs includes wildcards, any length of sub-string, the occurrence of sub string.
    I think the attached sheet shows a good example.
    (I don't mind what symbols are used as long as they're not common)
    (The formula I supplied =FIND(CHAR(1),SUBSTITUTE(A1,"XXX",CHAR(1),YYY), would actually work, if it knew what each symbol represented. Does Excel have any wildcards built in?)

    Again, ideally I'm looking for something I can use on Sheets, preferably not a sub in VBA.
    However *I think* creating a worksheet function in VBA might be the right approach? I've only ever created one or two of them before and am a bit skeptical, and also a bit thrown by how to process the wildcards.


    Thanks guys,
    Jimmy
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    *Bumping this thread.*

  18. #18
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    *Bumping this thread.*

  19. #19
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Wildcards but numbers only

    *Bumping this tread*

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Wildcards but numbers only

    You've had to bump it three times now. May I suggest you try reframing your question from post #16? Do that here and then maybe someone will understand what you are after and be able to help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  21. #21
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Wildcards but numbers only

    @AliGW Personally I have been ignoring this thread because I am waiting for a reply on another of Jimmy's threads which makes all the above bumps seem quite ironic.

    @Jimmy It is very frustrating trying to help people who "drop" their threads with no explanation
    Solution providers get satisfaction from knowing whether or not a suggestion got you to where you wanted to go - and probably learn more from getting it wrong than getting it right
    Leaving things "in mid air" is unhelpful to future readers of a thread
    A thread is not only for the originator's benefit - it can help lots of other people if everyone plays the game properly

    Getting back to this thread
    Caveat: This is more helpful pointer than complete solution.
    Familiarise yourself with RegEx (Regular expressions) - there are no shortcuts - it takes a bit of effort which will be well rewarded later.
    Look it up on google, here is one place to start
    Regex can do everything you require and vastly more than that - a few examples using the 3 UDF's below

    regex patterns.jpg

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by kev_; 03-04-2018 at 07:02 PM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

+ 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. Wildcards in VBA
    By oodam in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-30-2013, 06:44 AM
  2. wildcards
    By Trachr in forum Excel General
    Replies: 3
    Last Post: 08-24-2012, 08:38 PM
  3. Using IF with wildcards
    By jonasa in forum Excel General
    Replies: 2
    Last Post: 08-06-2007, 04:54 PM
  4. Wildcards
    By Richard Davies in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-20-2007, 08:14 AM
  5. use of wildcards
    By italiavb in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-14-2006, 12:55 AM
  6. Wildcards in RTD
    By JKC in forum Excel General
    Replies: 0
    Last Post: 02-03-2006, 03:35 PM
  7. [SOLVED] Wildcards
    By irresistible007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-20-2005, 06:20 AM
  8. [SOLVED] VBA Wildcards - HELP!
    By Co-op Bank in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-30-2005, 10:06 AM

Tags for this Thread

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