+ Reply to Thread
Results 1 to 5 of 5

Need to create a formula that either subtracts or displays 0

  1. #1
    Registered User
    Join Date
    04-09-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Need to create a formula that either subtracts or displays 0

    I am creating n interactive spreadsheet for tax time.
    On one line I will first need Excel to compare the values in 2 different cells.
    If cell B is less than cell A, then subtract cell B from cell A. If cell B is NOT less than cell A, then display 0. How would I write that as a function in Excel?

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

    Re: Need to create a formula that either subtracts or displays 0

    Try

    =MAX(0,A1-B1)

  3. #3
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Need to create a formula that either subtracts or displays 0

    Jommo1 wrote simplest way. Its alternative

    =if(b1<a1,a1-b1,0)
    Appreciate the help? CLICK *

  4. #4
    Registered User
    Join Date
    04-09-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need to create a formula that either subtracts or displays 0

    Thank you so much, both of you.
    I used Jommo1's MAX formula and it worked perfectly.
    Thanks to AZ-XL's comments, I'll have a backup plan. Besides, seeing a it expressed in different ways helps me better remember how to construct and read formulas. Its been awhile, but I'm having fun re-learning it all. . . .does that make me a geek?


    Yes! and proud I am. Thanks again.

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

    Re: Need to create a formula that either subtracts or displays 0

    Great, glad to help.

+ 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