Closed Thread
Results 1 to 11 of 11

I want to replace values greater than 200

  1. #1
    Registered User
    Join Date
    03-01-2010
    Location
    earth
    MS-Off Ver
    Excel 365
    Posts
    24

    I want to replace values greater than 200

    Hi,
    I want to replace all numbers in the worksheet which are greater than 200 with 200.
    I mean all numbers greater than 200 should be set to 200.
    values are not all in the same column or same row, they are spread throughout the worksheet.
    I tried using the Find and Replace, but it can replace only a specified value with only another specified value.
    I want to use some kind of a filter which will choose all numbers greater than 200, and make them 200.
    Please help me, thanks!

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,445

    Re: I want to replace values greater than 200

    Hi,

    Try this code

    Please Login or Register  to view this content.
    To enter, press ALT & F11 to open the VBA editor.

    Insert > Module > Paste the above code

    Close the VBA editor


    In excel select the cells you wish to run the code on.

    Go to tools > macros > run macro (i think - not able to run 2003 currently)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: I want to replace values greater than 200

    You mention that you tried find and replace

    If there are no numbers over 299, and we are talking about whole numbers (integers), then you could try this

    Find what:= 2**
    Replace with:= 200
    Options >> check the box Match entire cell contents
    Replace All

    This is only meant for your information, not as a substitute for sweeps answer.
    Last edited by Marcol; 11-04-2010 at 10:58 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Registered User
    Join Date
    09-03-2012
    Location
    paala
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: I want to replace values greater than 200

    Please Login or Register  to view this content.
    Hey , I want to use the same code as above but I want to check if rcell with one line above and one column in left is =0
    Can someone help me?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: I want to replace values greater than 200

    Please Login or Register  to view this content.
    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: I want to replace values greater than 200

    Hello paala, and welcome to the forum.

    Unfortunately you have inadvertently broken one of the forum rules. Please read the following and make the necessary change. Thanks.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

  7. #7
    Registered User
    Join Date
    06-06-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: I want to replace values greater than 200

    Quote Originally Posted by sweep View Post
    Hi,

    Try this code

    Please Login or Register  to view this content.
    To enter, press ALT & F11 to open the VBA editor.

    Insert > Module > Paste the above code

    Close the VBA editor


    In excel select the cells you wish to run the code on.

    Go to tools > macros > run macro (i think - not able to run 2003 currently)

    Ok this worked...but, there's one problem. I need to replace every # in my entire worksheet say with 10,000 to create a dummy for someone i cant reveal top financial #s to yet wants to see how my spreadsheet works. The problem is, it replaced all the text wtih 10,000 too? Is there a way to only replace #'s greater than 0 wtih 10,000?

  8. #8
    Registered User
    Join Date
    06-06-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: I want to replace values greater than 200

    Quote Originally Posted by usansay18 View Post
    Ok this worked...but, there's one problem. I need to replace every # in my entire worksheet say with 10,000 to create a dummy for someone i cant reveal top financial #s to yet wants to see how my spreadsheet works. The problem is, it replaced all the text wtih 10,000 too? Is there a way to only replace #'s greater than 0 wtih 10,000?
    Nvm i figured it out on my own...

    here's the code if anyone needs it

    Please Login or Register  to view this content.
    Last edited by arlu1201; 06-07-2013 at 01:54 AM.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I want to replace values greater than 200

    usansay18,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Registered User
    Join Date
    09-30-2014
    Location
    den bosch, holland
    MS-Off Ver
    Office 2013
    Posts
    2

    Re: I want to replace values greater than 200

    You'll probably never read this since it's 4 years ago but you helped me out so much here. Thanks!

  11. #11
    Registered User
    Join Date
    09-30-2014
    Location
    den bosch, holland
    MS-Off Ver
    Office 2013
    Posts
    2

    Re: I want to replace values greater than 200

    Hi,

    Try this code

    Select Code copy to clipboard
    Sub Two_Hundred()
    Dim rCell As Range

    For Each rCell In Selection
    If rCell.Value > 200 Then rCell.Value = 200
    Next rCell

    End Sub
    To enter, press ALT & F11 to open the VBA editor.

    Insert > Module > Paste the above code

    Close the VBA editor


    In excel select the cells you wish to run the code on.

    Go to tools > macros > run macro (i think - not able to run 2003 currently)
    You'll probably never read this since it's 4 years ago but you helped me out so much here. Thanks!

Closed 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