Consulting

Results 1 to 3 of 3

Thread: Insert a Hyphen at two characters from the end of a String

  1. #1
    VBAX Regular
    Joined
    Nov 2008
    Location
    Cedar Creek, Texas
    Posts
    95
    Location

    Insert a Hyphen at two characters from the end of a String

    Hi,

    I have text in Column A starting at A2 as XHDIFM and as XHCRSFM.
    I wish to insert a hyphen two characters from the end of each string, so the above text will look like XHDI-FM and XHCRS-FM

    I have googled but get nothing close to what I want.

    Can someone please offer a solution??

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    B2 and copy down.
    =LEFT(A2,LEN(A2)-2)&"-"&RIGHT(A2,2)

  3. #3
    VBAX Regular
    Joined
    Nov 2008
    Location
    Cedar Creek, Texas
    Posts
    95
    Location
    Thanks Kenneth, worked like a charm
    Much appreciated!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •