+ Reply to Thread
Results 1 to 8 of 8

Add values> 0 and <0 in one cell

  1. #1
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Add values> 0 and <0 in one cell

    Good evening as the title suggests, I can't make the simulation of a column with formula to have a single total.

    In the attached file you will find the example of column J to be added and the attempts made one at a time work but, if I combine the formula with the wrong result I40

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Add values> 0 and <0 in one cell

    Why not just:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    or
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The latter probably (/) shall be committed as array formula in Excel 2007 and 2010

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Re: Add values> 0 and <0 in one cell

    hanks
    but, maybe I didn't explain myself
    the sum of numbers> 0 = 64
    the sum numbers <0 = -64
    Making the sum must give result = 0

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Add values> 0 and <0 in one cell

    Why not just use SUM?
    Or to get rid of the minute fractions something like
    =ROUND(SUM(J6:J36),2)

  5. #5
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Add values> 0 and <0 in one cell

    Quote Originally Posted by Berna11 View Post
    maybe I didn't explain myself
    the sum of numbers> 0 = 64
    the sum numbers <0 = -64
    Making the sum must give result = 0
    Much better! In other words, the formula =SUM(J6:J36) is what you want, as you wrote in J37.

    The only problem is: the result is not exactly zero.

    You should write: =ROUND(SUM(J36:J36),0) if you expect an integer result.

    Alternatively, you might correct the time arithmetic in each of J6:J36. Write: ROUND((L7-K7-M7)*24,0).

    -----

    The problem is: Excel time is represented as a fraction of 1 day; for example, 1 hour = 1/24. And most decimal fractions cannot be represented exactly in 64-bit binary floating-point, which Excel uses to represent numerical values internally.

    Consequently, what appears to be exact integers in J6:J36 are not(!). For example, note that =J7-INT(J7)=0 returns FALSE(!).
    Last edited by joeu2004; 04-05-2020 at 03:28 PM.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Add values> 0 and <0 in one cell

    Indeed, original formula was fine.
    If you want just to see the result - use formatting of the cell - not general, but a number with desired (0?) decimal digits.
    If you plan to use the result in further calculations - use rounding.

  7. #7
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Re: Add values> 0 and <0 in one cell

    ok, correct:
    = ROUND (SUM (J6: J36), 0)

    or:
    = ROUND (SUM (J6: J36), 2)

    thanks

    thanks

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Add values> 0 and <0 in one cell

    You're welcome & thanks for the feedback

+ 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. Lookup multiple values from a single cell, return the values to a cell
    By mdvizcay in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-16-2019, 12:57 PM
  2. [SOLVED] VBA help needed to Fill cell values based on Adjacent Cell values
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-06-2014, 07:08 AM
  3. Comma Separated Cell Values to Column of Unique Cell Values
    By Nuggetross in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-02-2014, 07:24 PM
  4. Replies: 8
    Last Post: 07-16-2012, 08:21 AM
  5. Automatically emailing a range of cells if the cell values = other cell values.
    By Apollon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2012, 01:40 AM
  6. [SOLVED] Macro to loop through cell values in a column and format multiple cell values
    By Roop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2012, 05:39 PM
  7. Replies: 1
    Last Post: 04-24-2012, 09:24 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