+ Reply to Thread
Results 1 to 13 of 13

Insert two slashes if not found

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Insert two slashes if not found

    Hello everybody

    I have a large amount of data in Column A
    Some data begin with this string "ID Owner Name" like that
    Please Login or Register  to view this content.
    In range("A1:A500") I need to do the following:
    If the cell begins with that string "ID Owner Name" then to count slashes / and make sure there are two slashes in the cell
    If not found any slashes or found one only ... slashes should be added after the string "ID Owner Name" to be like that "ID Owner Name /"
    As for other data which don't begin with the string to remain as they are
    Hope it is clear

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert two slashes if not found

    Hi Yasser,

    Where should the other slash be? In the meantime:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Insert two slashes if not found

    Thanks a lot Mr xladept for this nice code

    I have to attach a sample
    In the attached WB there are the expected results
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Insert two slashes if not found

    Hello YasserKhalil,

    The workbook you posted does not open. You should upload another copy of the workbook.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Insert two slashes if not found

    Please Login or Register  to view this content.

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Insert two slashes if not found

    seems it works too
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Insert two slashes if not found

    Thanks a lot Mr Jindon for this magic solution. It is really wonderful
    Mr. Nelim thank you for this simple code but it is not effective for all instances. I like your simpleness

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert two slashes if not found

    Well - it's not pretty but it works!

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Insert two slashes if not found

    Mr xladept
    Thank you very much for your help
    It works very well
    Thank you for all of you for this great help

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert two slashes if not found

    Hi Yasser,

    You're welcome! And - thanks for the rep!

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Insert two slashes if not found

    May I have UDF function that enables me to insert slash after specific string

    Function InsertSlash(rng as range, str as string desired to insert slash after it if not found)

    for example : the string "Hello"
    In A1 :
    Please Login or Register  to view this content.
    >> should be >> Hello / everybody
    In A2 :
    Please Login or Register  to view this content.
    >> should remain as it is

    Note that the spaces are not equal .. some times one space two or more

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Insert two slashes if not found


  13. #13
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Insert two slashes if not found

    Quote Originally Posted by jindon View Post
    Please Login or Register  to view this content.
    Thanks a lot Mr. Jindon for this masterpiece.
    I didn't notice that post till now ..
    It is really wonderful

+ 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] Insert 2 new lines after same text is found
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-15-2013, 05:15 PM
  2. Insert Row where value not found
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2012, 03:32 PM
  3. Insert row before the found word
    By emina002 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-23-2011, 09:39 PM
  4. Insert Row For Value Not Found
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-14-2009, 01:07 PM
  5. found and insert
    By sungpeng in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2007, 01:03 AM

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