Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Excel support: Calculating difference between columns  (Read 3008 times)

0 Members and 1 Guest are viewing this topic.

Sophie

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Windows 10
    Excel support: Calculating difference between columns
    « on: November 03, 2017, 11:01:41 AM »
    Hello,

    I have two columns of data and I would like to be able to calculate the difference between the two. So I want Column C to show me whether the data in Column A is higher or lower than the data in Column B and by how much.

    As it stands, I have applied this formula to Column C: =ABS(A2-B2)

    However, this doesn't tell me which cell has the higher number, just the difference between the two. I want it so that if A is 5 and B is 4, then C shows as -1. If, however, A is 5 and B is 6, I want C to show as 1 (or +1 but Excel doesn’t like that!).
     
    Is there a way of doing this?

    Any help would be much appreciated. As you can probably tell from the way I have worded this, I am not naturally mathematical! And this is part of the reason I can’t find the answer: I don’t know the terms for what I want to do.

    Thanks in advance!

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: Excel support: Calculating difference between columns
    « Reply #1 on: November 03, 2017, 03:40:10 PM »
    Would that not simply be B-A?
    I was trying to dereference Null Pointers before it was cool.

    Mark.



      Adviser
    • Forum Regular
    • Thanked: 67
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 10
    Re: Excel support: Calculating difference between columns
    « Reply #2 on: November 03, 2017, 09:48:38 PM »
    BC is right, just have =B1-A1 in C1


    I would go one step further and right click C1, Format Cells, Number tab, Custom and type this in the Type: field +#,##0;-#,##0;"same"


    the breakdown of that 'formula' is negative amount;positive amount;zero amount
    you'll notice you can get your + symbol this way too.
    change "same" to "zero" or 0 depending on your liking.


    you can also go crazy and have something like +#,##0;-#,##0;"same"

    strollin



      Adviser
    • Thanked: 84
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Guru
    • OS: Windows 10
    Re: Excel support: Calculating difference between columns
    « Reply #3 on: November 04, 2017, 03:43:22 AM »
    You definitely want to leave out the ABS() part of the forumla out since an absolute number is ALWAYS positive.

    Mark.



      Adviser
    • Forum Regular
    • Thanked: 67
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 10
    Re: Excel support: Calculating difference between columns
    « Reply #4 on: November 04, 2017, 05:03:04 PM »
    you can also go crazy and have something like +#,##0;-#,##0;"same"

    the above example didn't display correctly, the '[' and ']' are forum code for special formatting.

    there should be <Blue> before the '+' and <Red> before the '-' and change '<' to '['

    Houb

    • Guest
    Re: Excel support: Calculating difference between columns
    « Reply #5 on: November 05, 2017, 02:42:24 AM »
    You can use an IF statement and I would be happy to write one up for you if the previous solutions don't cover what you need.

    soybean



      Genius
    • The first soybean ever to learn the computer.
    • Thanked: 469
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 10
    Re: Excel support: Calculating difference between columns
    « Reply #6 on: November 13, 2017, 10:14:26 AM »
    You might also find Conditional Formatting helpful.  You could use it to display numbers in column C in one color if the difference between column A and B is positive and another color if the difference is negative.