+ Reply to Thread
Results 1 to 10 of 10

Need macro or function to count words written in UPPERCASE

  1. #1
    Registered User
    Join Date
    12-09-2017
    Location
    Ohio
    MS-Off Ver
    Excel 2013 (home/student)
    Posts
    62

    Need macro or function to count words written in UPPERCASE

    Hi,
    I would like to have a macro or function that will count all the words (length >= 3) written in uppercase within a selection (such as column A). The cells contain multi-word text content, such as "The veterans on the team were SMITH, JONES, and B. HALLIDAY." That example would count as three uppercase words towards the grand total.

    Thanks in advance!

    Russ

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Need macro or function to count words written in UPPERCASE

    UDF
    Use in cell like
    =CountUWord(A1)
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,432

    Re: Need macro or function to count words written in UPPERCASE

    Here is a non-RegExp UDF (user defined function) that you can also consider...
    Please Login or Register  to view this content.
    Last edited by Rick Rothstein; 09-04-2019 at 11:28 PM.

  4. #4
    Registered User
    Join Date
    12-09-2017
    Location
    Ohio
    MS-Off Ver
    Excel 2013 (home/student)
    Posts
    62

    Re: Need macro or function to count words written in UPPERCASE

    Thank you both, jindon and Rick. I can get both methods to work, but only if the argument of the function is a single cell (countuword(al) or wordcountuc(a1)). When I try to make the argument a range (a:a, or a1:d20, for example), I get a #VALUE error. Is there a tweak to fix that? I need to be able to count a range.

    Russ

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Need macro or function to count words written in UPPERCASE

    e.g.
    =CountUWord(A1:A8)

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-09-2017
    Location
    Ohio
    MS-Off Ver
    Excel 2013 (home/student)
    Posts
    62

    Re: Need macro or function to count words written in UPPERCASE

    Thanks again, Jindon. That does the trick. I will mark the thread solved.

    Russ

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,432

    Re: Need macro or function to count words written in UPPERCASE

    For the record, here if my function modified to handle ranges...
    Please Login or Register  to view this content.
    NOTE: There is one difference between jindon's function and mine... my function can handle non-contiguous ranges. So, if you wanted to count the upper case words in, say, cells H1, H2, J3 and K3 you would call the function like this...

    =WordCountUC((H1:H2,J3:K3))

    Note the "extra" parentheses surrounding the comma delimited non-contiguous ranges (you could include additional ranges in the comma delimited list as needed). Of course, if you need the functionality, I am sure jindon can modify his function to accommodate such a need.

  8. #8
    Registered User
    Join Date
    12-09-2017
    Location
    Ohio
    MS-Off Ver
    Excel 2013 (home/student)
    Posts
    62

    Re: Need macro or function to count words written in UPPERCASE

    Rick, thanks, that's helpful. Does that have anything to do with the RegExp difference you mentioned? I have no idea what that refers to.

    Russ

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,432

    Re: Need macro or function to count words written in UPPERCASE

    Quote Originally Posted by OhioRuss View Post
    Rick, thanks, that's helpful. Does that have anything to do with the RegExp difference you mentioned? I have no idea what that refers to.
    I am a little bit unclear about your question, but let me take a guess at at response. Contiguous ranges are rectangular groups of cells (for example, A3:A10 or B5:M5 or C3:F9)... non-contiguous ranges are two or more contiguous ranges (for example C3:F9 and M10:R20). As written, jindon's function needs the argument passed into it to be a single contiguous range whereas my function knows how to handle non-contiguous ranges. The note I provided explains how you have to specify non-contiguous ranges to my function (the addresses for the contiguous ranges making up the non-contiguous range must be delimited by commas and that comma-delimited list must be surrounded by their own set of parentheses (independent of the parentheses required by the function call itself). Did I guess correctly as to what you were inquiring about?

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Need macro or function to count words written in UPPERCASE

    OhioRuss,

    Some one is concerinig about what you don't even think of...

    This is to allow multi type of data source.

    You can use like
    =CountUWord(A1,D1:D2,"ABCD Efg",D6:D7,{"Axv","BBC 456"})
    Please Login or Register  to view this content.

+ 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] color uppercase words
    By Ethen5155 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2018, 05:18 PM
  2. VBA separate uppercase words from lowercase words.
    By mdalala in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2017, 12:28 PM
  3. Replies: 7
    Last Post: 06-05-2014, 02:50 AM
  4. Return value only if all words are uppercase
    By technigirl in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-17-2014, 09:19 AM
  5. Replies: 4
    Last Post: 04-27-2012, 06:38 AM
  6. How to uppercase selected words?
    By jgomez in forum Access Tables & Databases
    Replies: 5
    Last Post: 03-27-2012, 06:59 PM
  7. Count words-I want a function that can count the words in a cell
    By wilhelm in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-19-2009, 03:41 PM

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