+ Reply to Thread
Results 1 to 19 of 19

How could I replace an "=", "-" and "+" sign with space

  1. #1
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    How could I replace an "=", "-" and "+" sign with space

    Hi,

    I have a problem at hand and that is as follows.

    I have 4 columns of data. Now I want to check the whole table for "=", "+" and "-" and replace them with a single space, leaving the remaining text after those signs as it is.

    Eg., If the earlier text was "+hello Iam on a holiday" or "=Iam on a holiday" then it must get me the result as " Iam on a holiday".

    Please find the file attached for help.

    regards,
    Abhushan.
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: How could I replace an "=", "-" and "+" sign with space

    Ctrl + H and replace your sign with nothing or space.. what you need.

  3. #3
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: How could I replace an "=", "-" and "+" sign with space

    Hi select your data and use CTRL + H with needed combinations
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    Ctrl + H
    Find: =
    Replace: space (use a space not the work)

    Repeated as needed.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: How could I replace an "=", "-" and "+" sign with space

    Quote Originally Posted by zbor View Post
    Ctrl + H and replace your sign with nothing or space.. what you need.
    I would have done that if I had to just use only Excel, but then I need to do that using Macro (I forgot to mention that in the query).

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    Wow... three responses with exactly the same answer. Looks like a record

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    Why a macro? Is it being run on several worksheets in a workbook?

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    Please Login or Register  to view this content.
    Just used the macro recorder. Painless I would say.

  9. #9
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: How could I replace an "=", "-" and "+" sign with space

    Quote Originally Posted by abousetta View Post
    Why a macro? Is it being run on several worksheets in a workbook?
    I know, but the reason is that the file has to be run automatically as a process of everyday cycle, and there are loads of files (Nearly 100) to be run everyday. Now I guess it is evident that a macro might just beat the rest!

  10. #10
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: How could I replace an "=", "-" and "+" sign with space

    Iam New to Macro, so I dont understand how to record a macro. It would be great if someone could help me out by posting the code that would run with other pieces of code already done before. I mean to say that I just want a new subroutine for this.

    Hope someone could help.

    Thanks/

  11. #11
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: How could I replace an "=", "-" and "+" sign with space

    try to run this it should replace all signs You mentioned
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: How could I replace an "=", "-" and "+" sign with space

    Quote Originally Posted by tom1977 View Post
    try to run this it should replace all signs You mentioned
    Please Login or Register  to view this content.
    Thank you, it works fine, but this checks for the whole string for all the 3 characters, but then if I want to check only in the first character in the cell then is there another way for that?

    Regards,
    Abhushan.

  13. #13
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    Abhushan, from experience this is probably going to be a smaller part of a bigger code. Could you show us the code that this will fit into so we can just add what you need or else there could be a lot of incremental things to the wish list. As for the macro recorder, it is essential that you learn how to use it. It is available inside of Excel (Developer Tab).

  14. #14
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    This should do what you asked for. Make sure that the cells are formatted as text or you will get an error 2029 message:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: How could I replace an "=", "-" and "+" sign with space

    Quote Originally Posted by abousetta View Post
    This should do what you asked for. Make sure that the cells are formatted as text or you will get an error 2029 message:

    Please Login or Register  to view this content.
    Hi, the previous code that you had given, worked, but the one that you gave in the end (the one included in this quote), bumped, even after I had converted the whole range to text format.

    Anyways thanks for the previous code.

  16. #16
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    I don't know what you mean by "bumped". I tested it from my end and it worked fine. If it's not working for you then upload a sample so we can test it.

  17. #17
    Registered User
    Join Date
    04-27-2012
    Location
    New Delhi
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: How could I replace an "=", "-" and "+" sign with space

    See what I mean to say by bumped is that it is showing the error 2029 in the second code.
    The main code is too long, and the main problem lies in this function which is being called from the main subroutine

    Please Login or Register  to view this content.
    Is it because Iam not mentioning the place where the check for "=", "+", and "-" are to carried out it is causing the error?
    If so then please guide me as to how do I declare the place of check in this case.

    Thanks
    Abhushan.
    Last edited by Abhushan86; 05-03-2012 at 07:13 AM.

  18. #18
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How could I replace an "=", "-" and "+" sign with space

    If everything in the worksheet is formatted as text and there are no error messages (you have to clear these first) then this should work for you. I have gone down the pathway of arrays as they are faster for larger ranges. Have a look at the attached workbook.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  19. #19
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: How could I replace an "=", "-" and "+" sign with space

    Hi test it on data from first post select all cells and run this
    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)

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