+ Reply to Thread
Results 1 to 7 of 7

calculate absolute values for each date (group sum)

Hybrid View

Cedicon calculate absolute values for... 03-14-2011, 10:18 AM
stanleydgromjr Re: calculate absolute values... 03-14-2011, 10:31 AM
NBVC Re: calculate absolute values... 03-14-2011, 10:39 AM
Cedicon Re: calculate absolute values... 03-14-2011, 10:52 AM
Cedicon Re: calculate absolute values... 03-14-2011, 02:52 PM
NBVC Re: calculate absolute values... 03-14-2011, 02:59 PM
Cedicon Re: calculate absolute values... 03-14-2011, 05:06 PM
  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    scandinavia
    MS-Off Ver
    Excel 2007
    Posts
    27

    calculate absolute values for each date (group sum)

    Hi there,

    I have the following simple problem setup for two columns let's say A and B:

    01-02-2011 -534
    01-02-2011 53
    01-02-2011 43
    02-02-2011 25
    02-02-2011 -3523
    02-02-2011 532
    02-02-2011 3

    I need to calculate the absolute value for each date in the summing of column B.

    for example if u sum the whole column B as it is above then you get -3401. What I want is not to get rid of this minus-sign. But i want to get rid of the minus for each date-sum, for instance:

    01-02-2011 -534
    01-02-2011 53
    01-02-2011 43

    the output/number i want from this is abs(-534+53+43)=438

    then for

    02-02-2011 25
    02-02-2011 -3523
    02-02-2011 532
    02-02-2011 3

    abs(25-3523+3253+532+3)=2963

    so the total is 2963+438=3401

    can any help? ... should i use for-each construction or is it not simpler??

    thanks.
    Last edited by Cedicon; 03-14-2011 at 05:06 PM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: calculate absolute values for each date (group sum)

    Cedicon,

    So that we can get it right the first time:

    Where do you want the abs formula/result to be located in reference to each group?

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
    Last edited by stanleydgromjr; 03-14-2011 at 10:34 AM.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: calculate absolute values for each date (group sum)

    For most efficient way, you can add a helper columns.. so say your data is in A1:B7

    In C1 enter:

    =IF(A2=A1,"",ABS(SUMIF(A:A,A1,B:B)))

    copied down

    Then to get total Sum: =SUM(C:C)

    Edit: This also assumes dates are grouped together...
    Last edited by NBVC; 03-14-2011 at 10:42 AM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    01-13-2011
    Location
    scandinavia
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: calculate absolute values for each date (group sum)

    genius...that's cool... i can use that thanks!... I was making pivot table as i found out i also could...but this is clean and nice!!

  5. #5
    Registered User
    Join Date
    01-13-2011
    Location
    scandinavia
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: calculate absolute values for each date (group sum)

    Hi again,
    (i've attached my workbook)
    i have one more problem :S ..i have another column for currency and i want to make criteria on this and on the date-column where i want to have an output for each currency in each date .. i've tried with with this:

    =IF(and(B3=B2;A3=A2);"";ABS(SUMIF($A$2:$B$17;A2:B2;$C$2:C200))) -- but this does not work.

    what i want is for example if i have:

    1 USD 01-02-2001 -534
    2 USD 01-02-2001 53
    3 EUR 01-02-2001 43
    4 EUR 01-02-2001 -3151
    5 EUR 01-02-2001 352
    6 JPY 01-02-2001 -315
    7 JPY 01-02-2001 -3515
    8 USD 02-02-2011 25

    i want to calculate how much in absolute value pr. day i.e. in next column i want the output to be on the same row as the last currency for a day, so for USD on 01-02-2001 the output should be abs(-534+53)=481 and it is shown on row 2. .. i'd like to use the same function with IF and SUMIF, - u can use my workbook.

    thanks!!
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: calculate absolute values for each date (group sum)

    Since you are using XL2007 or later, try with SUMIFS, which allows multiple criteria...

    In H2:

    =IF(AND(A3=A2,B3=B2),"",ABS(SUMIFS($C$2:$C$17,$A$2:$A$17,A2,$B$2:$B$17,B2)))

    copied down

  7. #7
    Registered User
    Join Date
    01-13-2011
    Location
    scandinavia
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: calculate absolute values for each date (group sum)

    .thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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