+ Reply to Thread
Results 1 to 2 of 2

Create Function to Convert Certain Text to Uppercase

  1. #1
    Registered User
    Join Date
    01-26-2015
    Location
    Massachusetts
    MS-Off Ver
    2016
    Posts
    73

    Create Function to Convert Certain Text to Uppercase

    Hello,

    I'd like to create a Function to convert text to Uppercase conditionally. I would like any letters that are not part of the abbreviations Apt, No, or Unit to be uppercase. There are many variations. "Apt" and "No" may or may not have a period for abbreviation. The letters that need to be Uppercase may appear right after the number, before, or with a space on either side.

    Thank you.

    Current Desired
    Apt 25a Apt 25A
    Apt. 25 a Apt 25 A
    Apt 30ab Apt 30AB
    Apt ab30 Apt AB30
    No 25c No 25C
    Unit 500e Unit 500E
    Unit 500ab Unit 500AB
    Unit ab500 Unit AB500

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this !


    PHP Code: 
    Function UpperCaseAfterFirstWord$(TXT$)
             
    SPQ Split(TXT)
             For 
    R& = 1 To UBound(SPQ):  SPQ(R) = UCase(SPQ(R)):  Next
             UpperCaseAfterFirstWord 
    Join(SPQ)
    End Function

    Sub Demo()
        
    With Sheet1.Cells(1).CurrentRegion.Columns(1).Offset(, 1)
            .
    FormulaR1C1 "=UpperCaseAfterFirstWord(RC[-1])"
                
    .Formula = .Value
        End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 02-14-2015 at 11:04 AM. Reason: optimization …

+ 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. Function extract the uppercase letters from strings of text
    By Hellga in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2013, 05:48 AM
  2. Convert columns to uppercase
    By TWent in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-14-2010, 02:12 PM
  3. Convert lowercase text to uppercase text in Excel
    By mls_newbee in forum Excel General
    Replies: 1
    Last Post: 09-22-2010, 01:14 PM
  4. [SOLVED] How can I convert entire columns of text to Uppercase in Excel?
    By dplantlady in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-01-2005, 02:06 PM
  5. How can I convert the contents of a text selection from uppercase.
    By Phil Yandel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2005, 06:06 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