+ Reply to Thread
Results 1 to 11 of 11

My formula does not compare values

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    5

    Post My formula does not compare values

    I am making a spread sheet that is to compare one cell in a column to another cell in a column and produce a value. The value is either a product of subtraction or addition.
    B2 is current balance.
    C2 is Todays balance.
    D2 would be the change or current total from current balance after the comparison to add or subtract.
    I C2 value is always inserted manually.

    I do not know how to make a formula that does a comparison.

    If C2 is larger than B2 add the difference to B2 and show that number in D2.
    If C2 is less than B2 subtract the difference from B2 and show that number in D2
    Last edited by Nvalentino; 06-11-2012 at 11:09 PM. Reason: Rule # 1

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Need a formula

    Deleted. Title modified as requested
    Last edited by protonLeah; 06-12-2012 at 04:23 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    06-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Need a formula

    I hope my changes conform to the rules.
    I can make formulas to add, subtract or divide. I can't make formulas that do more than one function at a time. My issue is to compare then add or subtract accordingly.
    I hope that explains my issue better.
    Thank you for repling.

  4. #4
    Forum Contributor Russell Dawson's Avatar
    Join Date
    03-01-2012
    Location
    Yorkshire, England
    MS-Off Ver
    2007
    Posts
    608

    Re: My formula does not compare values

    Post withdrawn. Hlep has solution.
    Last edited by Russell Dawson; 06-12-2012 at 12:01 AM.
    If I helped, please don't forget to add to my reputation. (click on the star below the post)

    If the problem is solved, please: Select Thread Tools (on top of your 1st post) -> Mark this thread as Solved.

    Failure is not falling down but refusing to get up.

  5. #5
    Registered User
    Join Date
    12-02-2011
    Location
    Beijing, China
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Need a formula

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: My formula does not compare values

    Thanks hlep,,,
    As it turned out the correct formula for my spreadsheet is,,,=IF(C2>B2,(C2-B2),IF(C2<B2,(B2-C2)))

    Could not have accomplished it without your formula as my base.

    Thanks

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

    Re: My formula does not compare values

    Your formula will result in FALSE if/when C2=B2. Is that what you want?

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: My formula does not compare values

    Please note that the formula: =IF(C2>B2,(C2-B2),IF(C2<B2,(B2-C2))) only returns the difference between B2 and C2 as a positive number. You should do this with:
    =ABS(B2-C2)

  9. #9
    Registered User
    Join Date
    06-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: My formula does not compare values

    Where do I place =ABS(B2-C2) in the formula?
    I want a resulting number in D2 that is either positive or negative. If negative I would like to have a - minus sign in front of the number..
    Will your addition to the formula give that results?

  10. #10
    Registered User
    Join Date
    06-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: My formula does not compare values

    Thanks Guru for responding.
    I want a resulting number in D2 that is either positive or negative. If negative I would like to have a - minus sign in front of the number.

    As it is now I get a positive number in D2 not knowing if it is negative and as you stated a "FLASE" post in D2 if C2 and B2 or the same.

  11. #11
    Forum Contributor Russell Dawson's Avatar
    Join Date
    03-01-2012
    Location
    Yorkshire, England
    MS-Off Ver
    2007
    Posts
    608

    Re: My formula does not compare values

    Nvalentino - this should be a simple solution and it's probably the way you have asked the question that is causing confusion.

    What should appear in D2 when B2 is 16 and C2 is 14?

    What should appear in D2 when B2 is 14 and C2 is 16?

    If your solution given in post #6 works for you then adjust with this:

    =IF(C2>=B2,(C2-B2),IF(C2<B2,(B2-C2)))

+ 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