+ Reply to Thread
Results 1 to 4 of 4

Detect Number of Occurence's Of A Specific Character & Delete The First One

  1. #1
    Forum Contributor
    Join Date
    10-29-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    156

    Detect Number of Occurence's Of A Specific Character & Delete The First One

    Hi, I'm trying to count a specific character, if the specific character in the string occurs higher then 2, then delete the first time it occurs in a string

    The position of the first decimal point has to detected dynamically, as I have hundred of numbers in a text file.

    Ie., First detect if 11.356.11 contains two decimal points, then delete the first decimal point, so it reads 11356.11

    Note the first decimal point has to detected dynamically, as I have hundred of numbers with multiple decimal points, in a text file.


    Ive managed to detect if a string contains two decimal points, but cant figure out how to delete the first. Note the first decimal point has to be detected dynamically, as I have hundreds of numbers with multiple decimal points, ie 1.23.1 23.345.34 etc.

    Thanks.,

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Detect Number of Occurence's Of A Specific Character & Delete The First One

    Maybe, try:

    Please Login or Register  to view this content.
    Note: you are replacing the FIRST instance of "." x times, where x is decimal-1
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


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

    Re: Detect Number of Occurence's Of A Specific Character & Delete The First One

    Assuming your data is in Column A starting at cell A1 (change the red highlighted text if this assumption is wrong), this non-looping macro will make the changes you asked for...
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    10-29-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    156

    Re: Detect Number of Occurence's Of A Specific Character & Delete The First One

    Thanks guys

+ 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] Cannot find and delete a specific character
    By chengafni in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-02-2017, 06:30 AM
  2. [SOLVED] VBA Counting occurence of a specific character
    By VAer in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-30-2017, 09:07 PM
  3. [SOLVED] UDF function to remove the last occurence of specific character
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2016, 01:28 AM
  4. Code to delete text left of a specific character
    By Yoshi64 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-21-2014, 05:38 AM
  5. Remove all but first occurence of a character
    By rob_ford16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-11-2014, 09:52 PM
  6. [SOLVED] Delete row macro based on a specific character in the FIRST postion of a specified column
    By slawless in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-21-2012, 07:38 AM
  7. Macro to delete a specific character and capitalizing a column
    By abuchan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2011, 11:54 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