+ Reply to Thread
Results 1 to 24 of 24

Replace less than 0 with 0 in column

  1. #1
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Replace less than 0 with 0 in column

    Hi experts
    column t has values negative (less than zero). How can I replace those with zero without looping?

  2. #2
    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,364

    Re: Replace less than 0 with 0 in column

    You cold use Autofilter. Filter column T on negative values and replace (all) visible cells with 0.
    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


  3. #3
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Thanks. I wanted a line of code

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Replace less than 0 with 0 in column

    Try
    Please Login or Register  to view this content.

  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,364

    Re: Replace less than 0 with 0 in column

    Maybe this:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Thank you so much. this line is very great

  7. #7
    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,364

    Re: Replace less than 0 with 0 in column

    Quote Originally Posted by jolivanes View Post
    Try
    Please Login or Register  to view this content.
    OK, that's a bit shorter than mine

  8. #8
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    @jolivanes
    how can I color these cells?

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Replace less than 0 with 0 in column

    Use Trevor's suggestion of AutoFilter and color visible cells any color your heart desires.

  10. #10
    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,364

    Re: Replace less than 0 with 0 in column

    this:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Thank you so much both of you

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Replace less than 0 with 0 in column

    Or (assuming no formulae in Column T)
    Please Login or Register  to view this content.

  13. #13
    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,364

    Re: Replace less than 0 with 0 in column

    Quote Originally Posted by jolivanes View Post
    Or (assuming no formulae in Column T)
    Please Login or Register  to view this content.
    That's outside the box!

  14. #14
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Replace less than 0 with 0 in column

    Hi Trevor.
    I am glad you didn't say "outside the closet"!!!! (like coming out of the closet)
    Thanks though

  15. #15
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Can the same outside the box be applied to the condition
    (cells that are less than 2000)?

  16. #16
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Replace less than 0 with 0 in column

    What was the outcome when you tried it?
    I would say that you'll be looking at a loop. Which is OK

    Have you tried Trevor's solution from Post #10? Change the less than 0 to any number you want to use.
    Last edited by jolivanes; 03-28-2022 at 02:07 AM.

  17. #17
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Yes it worked for looping, but I told myself that ideas outside box has its word

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Replace less than 0 with 0 in column

    Hi guys,

    Could this not be simply done with Conditional Formatting?

    Just wondering.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  19. #19
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Will conditional formatting change for example -125 to 0?

  20. #20
    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,364

    Re: Replace less than 0 with 0 in column

    Will conditional formatting change for example -125 to 0?
    No. CF does what it says on the tin, Conditional Formatting. It can't change the content of a cell, just the way it is displayed.

  21. #21
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Thank you so much TMS sir

  22. #22
    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,364

    Re: Replace less than 0 with 0 in column

    Note: you CAN change the way the negative numbers are displayed using a CUSTOM format:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    It doesn't CHANGE the value in the cell, just displays it as 0.

  23. #23
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Replace less than 0 with 0 in column

    Yes but I found the total changed, so this is only apparent change not real change

  24. #24
    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,364

    Re: Replace less than 0 with 0 in column

    Yes but I found the total changed, so this is only apparent change not real change
    Don't understand this comment.

    Neither Conditional Formatting, nor a Custom Format, will change the value in the cell. You need one of the solutions you have already been given.

+ 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. vba code : find exact phrase in Column C using Column M and replace with Column N
    By daveexcelforum in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 04-02-2021, 01:05 PM
  2. Replace text in column cells according to other sheet column
    By Motorui in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-25-2017, 12:42 AM
  3. Replies: 9
    Last Post: 11-08-2015, 09:48 AM
  4. [SOLVED] Replace data in one column automatically based on another column
    By jzacharias in forum Excel General
    Replies: 1
    Last Post: 06-22-2015, 01:30 PM
  5. [SOLVED] Replace cell in Column A with value in Column B if contains similar character string
    By oybombadil in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-17-2015, 08:49 AM
  6. Replies: 3
    Last Post: 11-25-2014, 06:08 AM
  7. Replies: 4
    Last Post: 12-16-2013, 06:29 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