+ Reply to Thread
Results 1 to 4 of 4

Increment a number value within a string of varying lengths

  1. #1
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Increment a number value within a string of varying lengths

    I have a series of statements of varying lengths that contain a specific text and numeric value that I would like to increment. Using the Find/Replace function would take too long with the number of changes to make.

    An example of the string to find is "Row-1", "Row-2", etc. and can be found within a larger string such as ".opStatement-indent .row-7 .column-1" or ".opStatement-rowcolor .row-20 .column-5".

    What I would like to do is increment the "Row-" value by one. Because the row number can grow to over 100, doing a manual search and replace within this string became unbearable.
    Last edited by JimDandy; 02-06-2020 at 01:20 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Increment a number value within a string of varying lengths

    Administrative note

    Welcome to the forum

    missed the yellow banner advising how to get answers faster by posting a sheet ?

    Please take a moment to read it and attach a sheet accordingly.

    Thanks you for helping us help you

  3. #3
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Increment a number value within a string of varying lengths

    The attached shows an example of a segment of data that I would need to change
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Increment a number value within a string of varying lengths

    I was able to combine a couple solutions together to accomplish this task, one for extracting a string, a second for incrementing a number within a string and a third for substituting one for the other but the result is a huge formula.

    Is this the most efficient way to accomplish this or is there some more efficient method that I'm not seeing?

    First: Extract "Row-x" to helper column B:
    Please Login or Register  to view this content.
    Then increment "Row-x" to "Row-x+1" to helper column C:
    Please Login or Register  to view this content.
    Then substituting one for the other:
    Please Login or Register  to view this content.
    For the final result without using helper columns (longer because I've had to repeat certain parts:
    Please Login or Register  to view this content.

+ 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. Replies: 11
    Last Post: 07-17-2019, 07:47 PM
  2. Replies: 5
    Last Post: 02-02-2017, 09:11 PM
  3. Complex number sorting and addition, variable string lengths.
    By comp in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-11-2014, 03:39 AM
  4. [SOLVED] Concatenate with varying lengths and data
    By Unident in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-21-2013, 04:39 PM
  5. Best way to store lists of varying lengths
    By jik_ff in forum Access Tables & Databases
    Replies: 5
    Last Post: 04-17-2013, 08:54 AM
  6. Replies: 3
    Last Post: 05-09-2012, 11:36 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