+ Reply to Thread
Results 1 to 11 of 11

FIND & REPLACE rows of text in an Excel worksheet

  1. #1
    Registered User
    Join Date
    01-12-2019
    Location
    Calgary, AB
    MS-Off Ver
    2010
    Posts
    6

    FIND & REPLACE rows of text in an Excel worksheet

    I have spreadsheets with rows containing certain text which I have to replace with revised text as shown below.

    There are only 3 strings of text that need replacing in each worksheet however they could appear in any rows.

    IMPORTANT: Replacement text in brackets () must be bold with a red font.


    •“Electric in Pasture (CLAIM 100%)” TO “Electric in Pasture (CLAIM 100%)”

    •“Electric in Yard (represents 66.6%)” TO “Electric in Yard (figures represent 66.6%)”

    •“Natural Gas (represents 50%)” TO “Natural Gas (figures represent 50%)”


    HERE ARE SOME ROWS OF THE SPREADSHEET CONTAINING TEXT WHICH MUST BE REPLACED BUT MAY OCCUR IN ANY ROW:


    A B C D E F

    XXXXXXXXXX 2017

    Transactions by Account Report 01/01/2017 to 31/12/2017

    Sorted by: Date

    Date Comment Source # Debits Credits Balance

    5710 Electric in Pasture (CLAIM 100%) REPLACE WITH: “Electric in Pasture (CLAIM 100%)” 0.00 Dr
    18/01/2017 electric SW 30-21-5-4 pasture (CLAIM 100%) ATCO Electric 36.22 0.00 36.22 Dr
    15/02/2017 electric SW 30-21-5-4 pasture (CLAIM 100%) ATCO Electric 30.73 0.00 66.95 Dr
    17/03/2017 electric SW 30-21-5-4 pasture (CLAIM 100%) ATCO Electric 32.92 0.00 99.87 Dr
    5720 Electric in Yard (represents 66.6%) REPLACE WITH: “Electric in Yard (figures represent 66.6%)” 0.00 Dr
    20/01/2017 electric SW 28-21-5-4 including house (figures represent 66.6%) Direct Energy 101.10 0.00 101.10 Dr
    17/02/2017 electric SW 28-21-5-4 including house (figures represent 66.6%) Direct Energy 123.74 0.00 224.84 Dr
    21/03/2017 electric SW 28-21-5-4 including house (figures represent 66.6%) Direct Energy 110.91 0.00 335.75 Dr

    5860 Natural Gas (represents 50%) REPLACE WITH: “Natural Gas (figures represent 50%)” 0.00 Dr
    10/01/2017 gas utilities including house (figures represent 50%) Dry Country Gas 152.27 0.00 152.27 Dr
    08/02/2017 gas utilities including house (figures represent 50%) Dry Country Gas 124.55 0.00 276.82 Dr
    07/03/2017 gas utilities including house (figures represent 50%) Dry Country Gas 57.28 0.00 334.10 Dr

    Thanks in advance for any help you can give,

    Jerry

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    6,033

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    01-12-2019
    Location
    Calgary, AB
    MS-Off Ver
    2010
    Posts
    6

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Thank you Pepe Le Mokko! The files are uploaded.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-12-2019
    Location
    Calgary, AB
    MS-Off Ver
    2010
    Posts
    6

    Re: FIND & REPLACE rows of text in an Excel worksheet

    So sorry Pepe, my files still had the .xls extension instead of the .slsx extension. I will replace right now!

  5. #5
    Registered User
    Join Date
    01-12-2019
    Location
    Calgary, AB
    MS-Off Ver
    2010
    Posts
    6

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Hi again Pepe...new files are now uploaded.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    667

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Try

    Please Login or Register  to view this content.
    Last edited by mohan.r1980; 01-12-2019 at 05:38 AM. Reason: change the code
    Regards,
    MohanS


    "Perfection is not attainable, but if we chase perfection we can catch excellence." - Vince Lombardi

    You can simply say thanks by clicking "*Add Reputation" icon

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    13,349

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Quote Originally Posted by afterdinnerspeaker View Post
    IMPORTANT: Replacement text in brackets () must be bold with a red font.


    •“Electric in Pasture (CLAIM 100%)” TO “Electric in Pasture (CLAIM 100%)”

    •“Electric in Yard (represents 66.6%)” TO “Electric in Yard (figures represent 66.6%)”

    •“Natural Gas (represents 50%)” TO “Natural Gas (figures represent 50%)”
    Try
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-12-2019
    Location
    Calgary, AB
    MS-Off Ver
    2010
    Posts
    6

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Thank you MohanS, however your code doesn't initiate.

    The code sent by jindon seems to do exactly what I need.

    However, I do appreciate you working on it for me, Jerry

  9. #9
    Registered User
    Join Date
    01-12-2019
    Location
    Calgary, AB
    MS-Off Ver
    2010
    Posts
    6

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Thank you so much jindon!

    The code you provided works instantly, like magic.

    I sincerely appreciate your efforts and for solving this for me.

    Regards,

    Jerry

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    13,349

    Re: FIND & REPLACE rows of text in an Excel worksheet

    You are welcome and thanks for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  11. #11
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    667

    Re: FIND & REPLACE rows of text in an Excel worksheet

    Thank you MohanS, however your code doesn't initiate.

    The code sent by jindon seems to do exactly what I need.

    However, I do appreciate you working on it for me, Jerry
    No Problem jerry,
    Jindon Sir has unique style of scripting.
    He is "GURU" of this Forum and me also.
    he always has right solution.

    @Jindon Sir,
    Nice Scripting sir
    Last edited by mohan.r1980; 01-13-2019 at 10:07 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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