+ Reply to Thread
Results 1 to 6 of 6

Thread: IF negative formula

  1. #1
    Registered User
    Join Date
    10-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    76

    IF negative formula

    I need to add a statment to the formula below to say that if result is negative to display 0 rather than the negative number. Otherwise the normal result (positive) should display as normal. My question is, how should it be written and where do I embed it into the formula?

    =SUMPRODUCT(--('Paste Jason''s Prospect Report'!$O:$O="MBAIE"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"CHB"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"GW"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"CH"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"CHC"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"GWB"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"GWC"),--('Paste Jason''s Prospect Report'!$B:$B='GRAD COMPARATIVE REPORT'!A5),--('Paste Jason''s Prospect Report'!E:E<>"NOT"),--('Paste Jason''s Prospect Report'!O:O<>"K12"),--ISNUMBER(MATCH('Paste Jason''s Prospect Report'!$E:$E,{"DENY","PEND","WDRAW"},0)))-SUM(J8:J15)

    Thanks!

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: IF negative formula

    You would use a MAX

    =MAX(0,your formula)

    You can shorten the SUMPRODUCT by adopting as ISNA(MATCH test on Z tests in much the same manner as you have conducted an ISNUMBER(MATCH on Col E ... ie same construct but ISNUMBER becomes ISNA.

    Try to avoid using entire column references with SUMPRODUCT/Arrays - even though you can do this XL2007+ you shouldn't - it's an "expensive" formula.

  3. #3
    Registered User
    Join Date
    10-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: IF negative formula

    Ok, so does that mean it will look like this?

    =MAX(0,SUMPRODUCT(--('Paste Jason''s Prospect Report'!$O:$O="MBAIE"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"CHB"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"GW"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"CH"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"CHC"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"GWB"),--('Paste Jason''s Prospect Report'!$Z:$Z<>"GWC"),--('Paste Jason''s Prospect Report'!$B:$B='GRAD COMPARATIVE REPORT'!A5),--('Paste Jason''s Prospect Report'!E:E<>"NOT"),--('Paste Jason''s Prospect Report'!O:O<>"K12"),--ISNUMBER(MATCH('Paste Jason''s Prospect Report'!$E:$E,{"DENY","PEND","WDRAW"},0)))-SUM(J8:J15)

  4. #4
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: IF negative formula

    That depends upon the significance of the subtraction of J8:J15 - ie whether or not that is exclusive of the SUMPRODUCT min of 0 requirement.

    In terms of shortening per my post re: Z

    =MAX(0,SUMPRODUCT(--('Paste Jason''s Prospect Report'!$O:$O="MBAIE"),--ISNA(MATCH('Paste Jason''s Prospect Report'!$Z:$Z,{"CHB",GW","CH","CHC","GWB","GWC"},0)),--('Paste Jason''s Prospect Report'!$B:$B='GRAD COMPARATIVE REPORT'!A5),--('Paste Jason''s Prospect Report'!E:E<>"NOT"),--('Paste Jason''s Prospect Report'!O:O<>"K12"),--ISNUMBER(MATCH('Paste Jason''s Prospect Report'!$E:$E,{"DENY","PEND","WDRAW"},0)))-SUM(J8:J15)

    those in red are superfluous I think given the other conditions...

  5. #5
    Registered User
    Join Date
    10-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: IF negative formula

    Copied and pasted your formula. It said that there is an error with it. It would not specify where.

  6. #6
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: IF negative formula

    If we assume the MAX is meant to be inclusive of the subtraction of J8:J15 then based on my interpretation of your formula:

    =MAX(0,SUMPRODUCT(--('Paste Jason''s Prospect Report'!$O:$O="MBAIE"),--ISNA(MATCH('Paste Jason''s Prospect Report'!$Z:$Z,{"CHB","GW","CH","CHC","GWB","GWC"},0)),--('Paste Jason''s Prospect Report'!$B:$B='GRAD COMPARATIVE REPORT'!A5),--ISNUMBER(MATCH('Paste Jason''s Prospect Report'!$E:$E,{"DENY","PEND","WDRAW"},0)))-SUM(J8:J15))
    If the SUM is to sit outside of the MAX then alter the parentheses accordingly

    earlier error result of a) missing parenthesis in your first MAX formula b) missing " around GW in the ISNA(MATCH

+ 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.2.0