+ Reply to Thread
Results 1 to 6 of 6

Can you increment text in a substitute text formula

  1. #1
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Can you increment text in a substitute text formula

    Hi All

    I’m hoping someone out there has an answer to the following for me. I’m still in a novice learning curve on formulas / macros etc. and have looked for some time on google for fixes for this without luck.

    Issue:
    I have a spreadsheet where 1 x row equals 1 x transaction
    Cell R10 in the first row (R11 second row etc.) uses a Substitute Test formula to add two ‘spaces’ to the Receipt No located in cell C10 i.e.
    =SUBSTITUTE(C10,"BB15001","BB15001 ")
    This then becomes the first of four parts to a File Name string created in cell W10 where the spaces are necessary to make the file name user friendly and easily readable as in the W10 example:
    BB15001 John Smith JO 60.5

    However; if I drag R10 to R11 and view the formula I get =SUBSTITUTE(C11,”BB15001”,”BB15001 “) whereas I want =SUBSTITUTE(C12,"BB15002","BB15002 ")
    That is, the cell reference changes but not the Old_text or New_text resulting in the loss of the spaces which makes the File Name less readable. If I change the text manually it works as it should but as this spreadsheet will have over 300 rows I would like the text to increment as well when dragging R10.

    Can someone please help either with the existing formula and/or alternatives resolutions?

    Cheers
    Brett

  2. #2
    Forum Contributor jayajaya_4's Avatar
    Join Date
    05-09-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    259

    Re: Can you increment text in a substitute text formula

    Hello

    Can You Please attach a sample file to help you better

    Regards,
    Jaya

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,032

    Re: Can you increment text in a substitute text formula

    Here, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Can you increment text in a substitute text formula

    However; if I drag R10 to R11 and view the formula I get =SUBSTITUTE(C11,”BB15001”,”BB15001 “) whereas I want =SUBSTITUTE(C12,"BB15002","BB15002 ")
    That is, the cell reference changes but
    This expands on zbor's formula.


    =SUBSTITUTE(INDEX($C$10:$C$20,(MOD(ROWS($1:1),-10)+9)*2+1),"BB" &15000+ROW(A1),"BB" &15000+ROW(A1)&REPT(" ",2))


    This will address every other row starting at C10, C12, C14 ....... etc. Change the INDEX boundaries $C$10:$C$20 to suit.
    Last edited by FlameRetired; 08-19-2015 at 03:19 AM.
    Dave

  5. #5
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Re: Can you increment text in a substitute text formula

    Hi Zbor

    Thanks very much Zbor that works a treat, much appreciated!!

    Cheers
    Brett

  6. #6
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Re: Can you increment text in a substitute text formula

    Thanks guys for all your help its up and working

    Cheers
    Brett

+ 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] Need help completing a formula to find and substitute a character in a text string...
    By danielneedssomehelp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-27-2014, 11:32 AM
  2. [SOLVED] Need a formula to find and substitute a word in a text if a condition is met...
    By danielneedssomehelp in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-18-2014, 01:34 PM
  3. [SOLVED] Substitute Formula or Increment Help Please
    By plasma33 in forum Excel General
    Replies: 3
    Last Post: 03-13-2014, 12:15 AM
  4. text box increment by 1 contains text and integer.
    By thameem127 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2013, 05:37 AM
  5. How to use a substitute formula to substitute text entries to a different text entry
    By andybocchi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-01-2010, 07:50 PM
  6. Replies: 5
    Last Post: 11-16-2009, 08:24 AM
  7. Substitute text
    By jeff.p in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2007, 05:01 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