+ Reply to Thread
Results 1 to 5 of 5

Using Find & Replace - problems with repeated characters

  1. #1
    Registered User
    Join Date
    04-23-2012
    Location
    UK, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Using Find & Replace - problems with repeated characters

    Hi all

    I have a spreadsheet that contains cells with multiple lines - each line has been preceded with a roman numeral to reference the entry:

    i. entry 1
    ii. entry 2
    iii. entry 3
    etc

    I have written a simple vba script to parse those lines and enter each individual entry into an adjacent cell in the same row but I am having limited success with that due to repeating characters - for example if I use InStr and search for "iv." and "v." to get the string between those two entries it gives a value of 1 as the difference as it finds "v." in the string "iv." on two occasions.

    The other approach I thought about was to do a global find/replace in that column using the built in excel function. However, I have the same problem = if I do a global replace on, say, "i." with "1" then I get entries such as "i1." and "ii1." for what was roman ii. and iii.

    Does anyone have any help on how to do exact string matching? I've tried using the options in find/replace to look for exact string but that doesn't work.

    Any advice would be appreciate.

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: Using Find & Replace - problems with repeated characters

    Are you just wanting to split "ii. entry 2" into 2 columns or do you want to change "ii." into "2." also so it becomes "2. entry 2" in 2 columns??

  3. #3
    Registered User
    Join Date
    04-23-2012
    Location
    UK, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Using Find & Replace - problems with repeated characters

    Hi philaugust - no just to replace the ii. with 2. to start with will be fine then I can run code based on straight numbers to split into the relevant columns.

    Thanks

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Using Find & Replace - problems with repeated characters

    how to do exact string matching?
    source (A1)
    iv. entry 1
    vii. entry 2
    v. entry 3

    =RegExp_Replace(A1,"\b[v]{1}\b","5")

    result
    iv. entry 1
    vii. entry 2
    5. entry 3

    but in this case it doesn't work for global but for single cell(s)

    EDIT:
    I forgot to say, you need dafine VBA code for this function
    Last edited by sandy666; 05-03-2017 at 06:05 AM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,892

    Re: Using Find & Replace - problems with repeated characters

    Please Login or Register  to view this content.
    From the web

    to use

    =Arabic("xxii")

    String must be text

+ 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] Find non repeated characters in a string
    By salasmau in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2015, 10:03 AM
  2. [SOLVED] find and replace to not replace characters found as wildcards
    By sabutler4 in forum Excel General
    Replies: 4
    Last Post: 07-03-2013, 06:48 PM
  3. Find and replace characters.
    By Cyberpawz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2012, 02:31 PM
  4. [SOLVED] Find and replace - max characters per row
    By dshilan in forum Excel General
    Replies: 1
    Last Post: 04-03-2012, 03:09 PM
  5. find and replace certain characters
    By imichalopo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2010, 03:08 PM
  6. Problems with Find & Replace
    By Gazzr in forum Excel General
    Replies: 3
    Last Post: 04-07-2006, 12:41 AM
  7. Find and Replace Characters
    By lytaylor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2005, 09: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