+ Reply to Thread
Results 1 to 6 of 6

Extracting underlined text

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2013
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Extracting underlined text

    Does anyone know of a formula that would extract only underlined text from a text string?

    Thanks

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Extracting underlined text

    I'd recommend asking a moderator to move your post to the VB Forums. There's nothing I know of that doesn't incorporate VB or at least a User Defined Function to accomplish this.

    Maybe a looping macro that checks every nth character's Underline property and returns them as a string?

  3. #3
    Registered User
    Join Date
    09-05-2013
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Extracting underlined text

    Thanks for the suggestion.

  4. #4
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Extracting underlined text

    Maybe a UDF
    Remark: extracts the underlined text, but the results are not underlined. Is it ok?

    Function Underline(r As Range) As String
        Dim i As Long
        
        For i = 1 To Len(r.Value)
            With r
                If .Characters(Start:=i, Length:=1).Font.Underline <> xlUnderlineStyleNone Then
                    Underline = Underline & .Characters(i, 1).Caption
                Else
                    If Mid(r, i, 1) = Chr(32) Then Underline = Underline & Mid(r, i, 1)
                End If
            End With
        Next i
        
        Underline = Application.Trim(Underline)
    End Function
    Usage
    B1
    =Underline(A1)
    copy down

    A B
    Some text and more underlined text text underlined text
    Text not underlined
    Some Text Some Text
    More New Text underlined New Text
    Marcelo Branco

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Extracting underlined text

    I think I had the right idea and it looks like it works!

    Thanks Marcelo!

  6. #6
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Extracting underlined text

    Maybe a looping macro that checks every nth character's Underline property and returns them as a string?
    Yes your idea is perfect.


    Quote Originally Posted by daffodil11 View Post
    I think I had the right idea and it looks like it works!

    Thanks Marcelo!
    You are welcome.

+ 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. Sheet tab name to be hyperlinked without being underlined & to be in linked in Text Box
    By paradise2sr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-14-2013, 01:33 AM
  2. Losing bolded and underlined text in the process...
    By sinnes in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-26-2010, 11:19 AM
  3. Underlined and bolded text causes Excel to crash
    By ambarrovecchio in forum Excel General
    Replies: 1
    Last Post: 06-22-2007, 09:27 AM
  4. How can I find underlined text?
    By brade in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2007, 03:00 PM
  5. [SOLVED] How can I detect if the text in a cell is underlined?
    By plh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2006, 10:10 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