+ Reply to Thread
Results 1 to 6 of 6

add max(0,....) to several cells

  1. #1
    Registered User
    Join Date
    06-07-2017
    Location
    Warsaw
    MS-Off Ver
    2016
    Posts
    13

    add max(0,....) to several cells

    Hello,

    I have several CELLS with lengthy formulas and numeric values. When I edit the inputs, some of the numbers in my CELLS become negative and I want to prevent them from doing so. I want the CELLS to reflect the maximum of 0 and the formula output. I know that I can fix it by adding =MAX(0,FORMULA) to each cell, but that would be very time consuming. Is there a way to add the max function to several cells simultaneously?

    Thanks in advance

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,762

    Re: add max(0,....) to several cells

    You can do it using Find & Replace (CTRL-H) a few times, but you need to look for common endings to your FORMULA to get the close bracket to be added in. Essentially, you select all the cells that you want to change, and on the first pass of CTRL-H you can change = to something like $$=, so that it is no longer a formula in those cells. Then you can change = to =MAX(0, and then change the formula ending to include the close bracket, and finally change $$= back to =

    It does depend on what your formula looks like.

    Hope this helps.

    Pete

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: add max(0,....) to several cells

    Dont think so.

    Maybe a VBA solution.
    Create a list of cell references you want to change.
    Then have VBA run through that list and add "MAX0," and ")" around the formula.
    Depends how many cells you have to change.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    06-07-2017
    Location
    Warsaw
    MS-Off Ver
    2016
    Posts
    13

    Re: add max(0,....) to several cells

    Thanks!!!

    @Pete this is brilliant and solved my problem.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,762

    Re: add max(0,....) to several cells

    Well, that's good to hear. As I said, this method depends on finding something unique at the end of the formula, so it might be a close-bracket or two, or a quote and close bracket.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post and mark this thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

  6. #6
    Registered User
    Join Date
    06-07-2017
    Location
    Warsaw
    MS-Off Ver
    2016
    Posts
    13

    Re: add max(0,....) to several cells

    @Pete done and done. Thanks again.

+ 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. Replies: 4
    Last Post: 02-11-2015, 09:02 AM
  2. Replies: 0
    Last Post: 01-21-2015, 12:05 PM
  3. [SOLVED] Linking cells globally to allow users the ability to change cells on separate sheet/cells.
    By V1gilante in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2014, 10:47 PM
  4. combining many cells in one cells keeping character font and hyperlinks of all cells
    By mankind00 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-27-2012, 09:41 AM
  5. Replies: 4
    Last Post: 06-17-2011, 08:53 AM
  6. Formula: Drop Down List -> Choose Option Finds Cells & Replace Cells with Cells
    By g00glethis1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2010, 01:10 PM
  7. Replies: 2
    Last Post: 06-24-2010, 04:53 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