+ Reply to Thread
Results 1 to 8 of 8

Sign Switch Logic and Subtotal

  1. #1
    Registered User
    Join Date
    04-16-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    22

    Cool Sign Switch Logic and Subtotal

    Hello Excel Friends,

    I believe the logic is correct in my calculations, but I'm having a sign switch problem when I use Subtotal() to sum up a column. I have attached a file that demonstrates the problem. I outline what I am doing in the file.

    I perform calculations on raw data, then I use =I5/ABS(I$2)*ABS(C$2) to determine what percentage each cell is of a total value. I use ABS() on the two total cells in that formula to make sure no signs cancel out - meaning I only want the sign of the I5 cell in the result. (The signs of I2 and C2 can flip depending on the data.)

    That all seems to work perfectly for each row. However, when I sum up these result cells using SUBTOTAL(9,...) the resulting sum can have the sign switched even though it still equals the correct total.

    The attached file outlines the issue.

    Any help is greatly appreciated,
    Ben

    Excel Forum Test File.xlsx

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Sign Switch Logic and Subtotal

    The formula doesn't indicate an absolutely value for row 2.

    Negative (* ÷) positive (* ÷) positive = negative

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sign Switch Logic and Subtotal

    I don't really understand what you're asking, or trying to do.

    But I can say with confidence that this formula
    =SUBTOTAL(9,L5:L18)
    Returns a negative number because the values in L5:L18 indeed add up to a negative number (-10.95)

  4. #4
    Registered User
    Join Date
    04-16-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Sign Switch Logic and Subtotal

    Hi daffodil11,

    The Absolute value formula is below in each cell (Rows 5 - 14). Row 2 just sums these up using SUBTOTAL().

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Sign Switch Logic and Subtotal

    Sorry, I meant the first value in the formula

    =I5/ABS(I$2)*ABS(C$2)

    I5 is not absolute, therefore if I5 is a negative, the result is negative.

    If you want positive values, =abs(I5)/ABS(I$2)*ABS(C$2) would have to be your formula.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sign Switch Logic and Subtotal

    Quote Originally Posted by daffodil11 View Post
    If you want positive values, =abs(I5)/ABS(I$2)*ABS(C$2) would have to be your formula.
    Or
    =ABS(I5/I$2*C$2)

  7. #7
    Registered User
    Join Date
    04-16-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Sign Switch Logic and Subtotal

    Hi Daffodil11,

    Yes, I would agree with that, but I want negatives too, it just depends on the data. It may be too complicated to explain on here.

    Thanks anyways,

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Sign Switch Logic and Subtotal

    The first ABS in the equation is causing the discrepancy.

    =I5/I$2*(C$2) should be your formula. ABS(I$2) is causing the sign flip.

    I tested it and everything matches if you remove this.

+ 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: 1
    Last Post: 09-18-2013, 04:10 PM
  2. Replies: 3
    Last Post: 03-13-2013, 01:20 AM
  3. Subtotal - Delete zero Subtotal and prior rows that calculate to that zero Subtotal
    By Whatsherface in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 08:37 PM
  4. Decimal Sign Replaced with ; Sign
    By lopiner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2009, 08:47 AM
  5. XL invoice replace the dollar sign with euro sign
    By Pamela casares in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-16-2005, 04:25 PM

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