+ Reply to Thread
Results 1 to 26 of 26

Trim Special Chars & Small Caps and Return the Big Caps and Space only

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Hello Excel Experts,

    ^[Ss][Oo][Cc][Ii][Aa][Ll] + ?[Rr][Oo][Aa][Mm] [0-9]+ ?$

    I need to return the above as SOCIAL ROAM.

    Anyone can help, pls?

    Thousands in a list to do. Thought of formula would be fast solution. If can get the right one.

    Appreciate your help.

    Thanks in advance.
    DZ

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    tRY THIS udf:

    =TRIM(ExtractCap(A1))

    Code, pasted into a module:

    Please Login or Register  to view this content.

    Enable macros on opening...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Wowww!! This is really awesome!!! So fast you did it!! Tqvm!!

    Now I have another challenge when there are numbers in between :-

    ^[Tt][Ee][Xx][Tt][12]00 ?$ ==> TEXT100, TEXT200
    ^[Tt][Hh][Ee][12]0 ?$ ==> THE10,THE20
    ^8[Tt][Hh][Aa][Tt]7[18]53 ?$ ==> 8THAT715,8THAT783
    ^[Yy][Ee][Ss] ?[Ww]1[05]$ ==> YES W10,YES W15
    ^[Oo][Ll][Aa] 1.2[Gg][Bb] ?$ ==> OLA 1.2GB


    Would you be able to modify your udf to filter based on the pattern above as well?

    Thanks in advance.

    DZ

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    You're welcome.

    I'm not sure about that, as I'm not much good with VBA.

    can you post the expected results from these strings?



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  5. #5
    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,871

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Glenn - the expected results are on the right, I think, and they do rather shift the goalposts!
    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.

  6. #6
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by Glenn Kennedy View Post
    You're welcome.

    I'm not sure about that, as I'm not much good with VBA.

    can you post the expected results from these strings?



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    You look expert enuff to me..

    Owh.. the expected result were all put next to the pattern after symbol ==>

    Maybe I just display them in a different way down here for your easier understanding:-

    CURRENT:
    ^[Tt][Ee][Xx][Tt][12]00 ?$
    ^[Tt][Hh][Ee][12]0 ?$
    ^8[Tt][Hh][Aa][Tt]7[18]53 ?$
    ^[Yy][Ee][Ss] ?[Ww]1[05]$
    ^[Oo][Ll][Aa] 1.2[Gg][Bb] ?$

    EXPECTED:-
    TEXT100, TEXT200
    THE10,THE20
    8THAT715,8THAT783
    YES W10,YES W15
    OLA 1.2GB

    The behaviour is something like below:
    if the number is outside [], it shud be treated as fixed digit
    if 1[35], it should come out as 13, 15
    if 1[56][98], it should come out as 159,168
    if 30[2][46]7, it should come out as 30247, 30267

    hope it helps to clarify...

    Thanks in advance

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    I assumed that they were part of the string!!

  8. #8
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by AliGW View Post
    Glenn - the expected results are on the right, I think, and they do rather shift the goalposts!
    Sorry, should I post as a new thread then?

    Please advise.

    Thanks in advance.

    DZ

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    No that's beyond me. i can extract the text and numbers, but am not sure where to go to meet your requirement.


    Maybe someoen else will jump in... Are there regular pattersn to your real data?? That might help.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by Glenn Kennedy View Post
    I assumed that they were part of the string!!
    Do you need me to post it as separate thread, Sir?

    I can do that and put this as SOLVED first.

    Please advise.

    Thanks in advance.
    DZ

  11. #11
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by Glenn Kennedy View Post
    No that's beyond me. i can extract the text and numbers, but am not sure where to go to meet your requirement.


    Maybe someoen else will jump in... Are there regular pattersn to your real data?? That might help.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    This helps a lot too anyway. Tqvm, Sir! Really appreciate it.

  12. #12
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Will put this as SOLVED as per original SUBJECT.

    Thank you so much to Mr. Glenn Kennedy. You're awesome!

  13. #13
    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,871

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    No, please don't start a new thread. Other people may be able to help. I've marked the thread unsolved.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    You're welcome.





    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  15. #15
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by AliGW View Post
    No, please don't start a new thread. Other people may be able to help. I've marked the thread unsolved.
    Alright then. Thanks!

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    There appears to be an inconsistency here base on my interpretation of the logic:

    ^8[Tt][Hh][Aa][Tt]7[18]53 ?$ with results of

    8THAT715,8THAT783

    Here 53 is treated as [53]

    To me, this does not accord wih ..
    if the number is outside [], it should be treated as fixed digit
    so I would have expected result to be

    8THAT7153,8THAT7853

    Please add a file with a good set of sample data.

    Attach a sample workbook (not image).

    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.
    Last edited by JohnTopley; 07-29-2017 at 08:36 AM. Reason: Request for file

  17. #17
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    I have a correction to make :-

    if 1[56][98], it should come out as 159,158,169,168
    Last edited by AliGW; 07-29-2017 at 09:02 AM. Reason: Unnecessary quotation removed.

  18. #18
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    You are correct. I'll work out on the sample data and revert to you soon. Tq
    Last edited by AliGW; 07-29-2017 at 09:02 AM. Reason: Unnecessary quotation removed.

  19. #19
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Here is my sample data for your kind perusal, Sir.
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Hi Excel Experts,

    I guess it must be very challenging to filter those with numbers within/without the brackets. But may I suggest if someone can just filter out everything except for
    BIG CAPS
    Space
    Numbers without the brackets
    Numbers within the brackets (means don't trim the brackets when there's number in it, be it in range or single numbers, eg. [27],[0-9],1[5]90)

    Sample:
    ^8[Tt][Hh][Aa][Tt]7[18]53 ?$ ==> 8THAT7[18]53 with this kinda output I can explain to customers already.


    Hopefully the above suggestion would give someone an insight.

    Thank you in advance.
    DZ

  21. #21
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by Glenn Kennedy View Post
    No that's beyond me. i can extract the text and numbers, but am not sure where to go to meet your requirement.


    Maybe someoen else will jump in... Are there regular pattersn to your real data?? That might help.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    This one would help if whichever the brackets that have numbers or range of numbers not being stripped off.. also it would means, if there's a range of numbers, eg. 0-9, the "-" symbol should not be trimmed off too..

    Thank you in advance.
    DZ

  22. #22
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    A partial solution as your post #20

    Please Login or Register  to view this content.
    in column B

    =Extract_text(A2)
    Attached Files Attached Files

  23. #23
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Wowww!!! This is really awesome, Sir!!! Thanks a million!!!
    Last edited by AliGW; 07-30-2017 at 06:38 AM. Reason: Unnecessary quotation removed.

  24. #24
    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,871

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    By the way, please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

  25. #25
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    A minor change will insert the blank:

    comment out the line below (add ' at beginning of line)

    ' text_string = Replace(text_string, " ", "")

    Does this solution satisfy your requirement?

  26. #26
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Trim Special Chars & Small Caps and Return the Big Caps and Space only

    Quote Originally Posted by JohnTopley View Post
    A minor change will insert the blank:

    comment out the line below (add ' at beginning of line)

    ' text_string = Replace(text_string, " ", "")

    Does this solution satisfy your requirement?
    Yes, Sir. Indeed I already did that after looking at your sample file. Thanks again for your big help!

    I already set to SOLVED for this thread. Thanks again.

+ 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. Check for small caps after the first space.
    By ABBOV in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-10-2016, 11:06 AM
  2. [SOLVED] small caps
    By BorisS in forum Excel General
    Replies: 2
    Last Post: 12-12-2005, 05:55 AM
  3. [SOLVED] How can I convert all Caps to first letter caps in Excel?
    By in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2005, 06:05 AM
  4. [SOLVED] How can I convert all Caps to first letter caps in Excel?
    By Fenljp26 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. How can I convert all Caps to first letter caps in Excel?
    By Fenljp26 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. [SOLVED] How can I convert all Caps to first letter caps in Excel?
    By Fenljp26 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. [SOLVED] excel sheet all caps and needs to be only the first letter caps..
    By kroberts in forum Excel General
    Replies: 1
    Last Post: 03-07-2005, 11: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