+ Reply to Thread
Results 1 to 4 of 4

Remove all but first occurence of a character

  1. #1
    Registered User
    Join Date
    06-04-2012
    Location
    Ohio
    MS-Off Ver
    MS Office 2003, 2007, 2010
    Posts
    14

    Question Remove all but first occurence of a character

    I want to be able to remove all but the first period in a text string.

    Example:

    Original Cell Content: 20.42.00.23

    What I want it to be: 20.420023


    I feel like I should be using something in conjunction with the =SUBSTITUTE, but not sure what...

    Thanks!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Remove all but first occurence of a character

    Try this:

    =LEFT(A1,FIND(".",A1)) & SUBSTITUTE(RIGHT(A1,LEN(A1)-FIND(".",A1)),".","")

    assuming your value is in A1.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    06-04-2012
    Location
    Ohio
    MS-Off Ver
    MS Office 2003, 2007, 2010
    Posts
    14

    Re: Remove all but first occurence of a character

    Omg thank you a thousand times! You have just saved me a ton of time! Works perfectly!

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Remove all but first occurence of a character

    slightly shorter =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,".","^",1),".",""),"^",".")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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] Formula to remove first two character is second character is a number.
    By herbie226 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2013, 02:59 PM
  2. [SOLVED] Remove first character in a cell when the second character is blank
    By eastdallasguy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2013, 03:11 PM
  3. Replies: 3
    Last Post: 11-20-2012, 10:03 PM
  4. Replies: 2
    Last Post: 03-21-2012, 12:28 PM
  5. Remove last character if
    By Johnf42 in forum Excel General
    Replies: 2
    Last Post: 09-02-2009, 06:43 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