+ Reply to Thread
Results 1 to 16 of 16

How do I tell a cell to activate a formula only when a value is greater than zero?

  1. #1
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    How do I tell a cell to activate a formula only when a value is greater than zero?

    Hi all,

    I'm VERY new to Excel and I'm trying to understand how to tell it to activate a formula I have already inputted ONLY when there is a value greater than zero. It's a very simple formula [=SUM(N15:R15)] but due to the nature of a further formula it is vital to, I need it to only activate when there is actually a value put into the row as when it is blank, it is giving a value of 0 meaning that the other formula is giving an incorrect answer.

    In case you're wondering, the other formula is supposed to give an ongoing, increasing figure based on the difference between a previous value and the current one over time. A little hard to explain but this is the formula I've created, maybe there's a simpler way to do it?

    =SUM(SUM(N4:R4)+(SUM(SUM(N5:R5)-SUM(N4:R4)))+(SUM(SUM(N6:R6)-SUM(N5:R5)))+(SUM(SUM(N7:R7)-SUM(N6:R6)))+(SUM(SUM(N8:R8)-SUM(N7:R7)))+(SUM(SUM(N9:R9)-SUM(N8:R8))))+(SUM(SUM(N10:R10)-SUM(N9:R9)))+(SUM(SUM(N11:R11)-SUM(N10:R10)))+(SUM(SUM(N12:R12)-SUM(N11:R11)))+(SUM(SUM(N13:R13)-SUM(N12:R12)))+(SUM(SUM(N14:R14)-SUM(N13:R13)))+(SUM(SUM(N15:R15)-SUM(N14:R14)))+(SUM(SUM(N16:R16)-SUM(N15:R15)))+(SUM(SUM(N17:R17)-SUM(N16:R16)))+(SUM(SUM(N18:R18)-SUM(N17:R17)))+(SUM(SUM(N19:R19)-SUM(N18:R18)))

    If that makes any sense to you, you might understand that any zeros further down will have an adverse affect on that sums outcome so I'm trying to stop the formulas from activating until a value is put in instead of if being blank and defaulting to zero.

    I hope this gives a good enough explanation for somebody to be able to help me but I know my information is far from ideal!

    Thanks

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Perhaps this is what you are after ...an array formula.

    =IF(ISBLANK(N19:R19),"",SUM(N19:R19))

    Confirm with Ctrl+Shift+ENTER and not just ENTER
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Without relying on the formulas, can you post a sample workbook showing how you want it to work? Mock it up manually, show us visually what your need is.

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

    ---------- Post added at 12:06 PM ---------- Previous post was at 12:04 PM ----------

    Quote Originally Posted by Ace_XL View Post
    Perhaps this is what you are after ...an array formula.

    =IF(ISBLANK(N19:R19),"",SUM(N19:R19))

    Confirm with Ctrl+Shift+ENTER and not just ENTER
    Perhaps a non-array solution if that works for you:

    =IF(COUNT(N19:R19)=0, "", SUM(N19:R19))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    How about this:

    Please Login or Register  to view this content.
    Docendo discimus.

  5. #5
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Not sure if this helps (or works) but I've attached a screenshot along with a link to the image so you should at least see one of them.
    Current.jpg

    http://www.ilovewhat.co.uk/random/Current.jpg

    Basically, for each time slot I am given a number of figures for an area, a column of totals for that area to the right of each set of figures and a total at the bottom of that column which should reflect the total for the last set of figures from the latest set of figures for each zone. I may have overcomplicated things by coming up with the formula I did (shown here):

    =SUM(SUM(N4:R4)+(SUM(SUM(N5:R5)-SUM(N4:R4)))+(SUM(SUM(N6:R6)-SUM(N5:R5)))+(SUM(SUM(N7:R7)-SUM(N6:R6)))+(SUM(SUM(N8:R8)-SUM(N7:R7)))+(SUM(SUM(N9:R9)-SUM(N8:R8))))+(SUM(SUM(N10:R10)-SUM(N9:R9)))+(SUM(SUM(N11:R11)-SUM(N10:R10)))+(SUM(SUM(N12:R12)-SUM(N11:R11)))+(SUM(SUM(N13:R13)-SUM(N12:R12)))+(SUM(SUM(N14:R14)-SUM(N13:R13)))+(SUM(SUM(N15:R15)-SUM(N14:R14)))+(SUM(SUM(N16:R16)-SUM(N15:R15)))+(SUM(SUM(N17:R17)-SUM(N16:R16)))

    It was the best thing I could come up with to have a reflection of the latest total for each zone so I could then get an overall total for all zones in the bottom right corner.

    If anyone can come up with a simpler solution, I would really appreciate it as I'm trying to get my head round this alongside a whole host of other responsibilities!

    Many thanks

  6. #6
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Not sure if this is what you meant:


    ilovewhat 2012-07-28.xlsx


    This is only valid if the hourly figures are always increasing.

  7. #7
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    The hourly figures will either always increase or remain the same. The row at the bottom should always reflect the latest set of figures and the formulas only ever be applied to the most recent set of figures. That's the bit I can't get my head round. The formula is simple but it's telling it to only ever apply to the latest FULL set of figures. I've also added a couple of columns to the right as well as some total boxes down in the bottom right corner. These should also only apply to the latest full set of figures.

    Current.jpg

  8. #8
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Could you please provide a live example (with at least one correct answer).
    It usually speeds up the time to solved.
    //Ola
    Mark the problem as Solved under the Yellow bar up Top right, under Thread Tools, when you received a solution.
    It saves time, to skip already solved threads.

  9. #9
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Sure thing, although for now I've given up on the current formulas and have been selecting the boxes manually each time.

    Current Sheet

  10. #10
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Trying to make some sense of things, is this what you're looking for?

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

  11. #11
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Yeah, for that bit that's correct as long as the figures that are fed into it are relative to the most recent set of figures ONLY, so the data cells put in will jump up a row each time.

    Also, the 'Totals' row along the bottom should be identical to the most recent figures also.

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Quote Originally Posted by ilovewhat View Post
    that's correct as long as the figures that are fed into it are relative to the most recent set of figures ONLY
    Can you post another sample file with some figures where the formula fails, type in the expected results there, and in the 'Totals' row.

  13. #13
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    Here's another image file explaining what I'm hoping to achieve and a current file for the same spreadsheet.

    Current.jpg

    Current

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    I can't download the last file for some reason, so this is based on the earlier one.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-27-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    You absolute legend! That's exactly what I was after! I was hoping that it might make sense to me once I saw the answer but I'm still just as stumped by it but at least I have it all in place and working now! That's gonna make the rest of my weekend/summer SOOOOO much easier and in that time I'm hoping I can understand how it works in the first place

    Thanks again, you've been a huge help!

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

    Re: How do I tell a cell to activate a formula only when a value is greater than zero?

    If you are satisfied with the solution(s) provided, please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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