+ Reply to Thread
Results 1 to 3 of 3

Extract a string that is in capitals from a cell

  1. #1
    Registered User
    Join Date
    02-18-2020
    Location
    London
    MS-Off Ver
    2016
    Posts
    1

    Red face Extract a string that is in capitals from a cell

    Hi,

    Hoping someone can help with the following

    If there are four consecutive capital letters that are found in a text string then I would like to extract them. For Example

    "Information is extracted from (ABCD122 QERT13) to retrieve the TELphone"

    In this instance, I would like to extract ABCD122 & QERT13. I would not like to extract TELphone as there were only 3 capital letters.

    Thanks.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Extract a string that is in capitals from a cell

    This is not "very simple question". Moreover, it's not obvious how would you like to have the result presented.
    Lets assume, you want to have these "words" listed next to a cell with the sentence.
    I prepared UDF (user defined function in VBA), which could be used for that. It's in the file and you can use it similar way, you are using standard functions. See cells B1, C1, B2, and B3:F3 in attached file.
    They contain such formulas as:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to find first matching word within sentence, or
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to find second one
    of course one could use also
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to find first word
    etc. (in row 3 I showed use of COLUMN to automatically advance the second argument as the formula is copied right
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The code for this function is:
    Please Login or Register  to view this content.
    And has to be stored in code module of the file (or in code module of PERSONAL.xlsb if ypou want to use it in any file on your computer)
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Extract a string that is in capitals from a cell

    I need to learn that regexp thing one day, pretty powerful stuff.
    A little bit to late and with simple VBA, here is my attempt:

    Please Login or Register  to view this content.
    Edit: found bugs, fixed and reuploaded
    Attached Files Attached Files
    Last edited by Jacc; 02-18-2020 at 02:25 PM.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

+ 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. [SOLVED] How to extract text string with different LEN in a cell
    By Rev12 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-30-2018, 03:17 PM
  2. [SOLVED] Extract Ticker Symbols (all capitals) from Text String
    By hoyasaxa215 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-07-2015, 11:02 AM
  3. Replies: 3
    Last Post: 07-25-2012, 07:54 AM
  4. [SOLVED] Insert space where Non-Capitals meet Capitals
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2012, 07:45 PM
  5. Extract string from a cell
    By scottt725 in forum Excel General
    Replies: 3
    Last Post: 04-10-2012, 10:37 PM
  6. Extract string from cell
    By greavesy in forum Excel General
    Replies: 14
    Last Post: 08-20-2009, 10:03 PM
  7. making cell transfers capitals
    By excellentexcel in forum Excel General
    Replies: 4
    Last Post: 04-24-2009, 07:39 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