+ Reply to Thread
Results 1 to 9 of 9

Thread: If >=0 and sumif or sumproduct

  1. #1
    Registered User
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    63

    If >=0 and sumif or sumproduct

    I am trying to sum Amount Ordered and Extra together and sum stock and gone together. But if any of the columns have no value, I don't want it to do the calculation. I keep getting an error and I don't know how to fix it.

    But eventually I am trying to write a function in one line in sheet 2 under Traffic so I can assign a conditional formatting.

    So if Sum of Stock and Gone is greater or equal to Sum of Amount Order and Extra it should be 2 or yellow



    =If(Inventory!$E$2:$E$7,Inventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),(Inventory!$F $2:$F$7,Inventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),">=0"),SUM(SUMIFS(Inventory!$ E$2:$E$7,Inventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),SUMIFS(Inventory!$F$2:$F$7,I nventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),3,2)
    Attached Files Attached Files
    Last edited by Jerseynjphillypa; 10-20-2011 at 03:02 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,608

    Re: If >=0 and sumif or sumproduct

    If I understand correctly, you don't want to sum the 2 columns if either is blank... so try:

    =SUMPRODUCT(--(Inventory!$C$2:$C$7<>""),--(Inventory!$D$2:$D$7<>""),--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$C$2:$C$7+Inventory!$D$2:$D$7)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: If >=0 and sumif or sumproduct

    Thanks for your help. Your assumption was correct, but I still got a value of 0, it should be blank. Would I use "" at the end of the function
    Attached Files Attached Files
    Last edited by Jerseynjphillypa; 10-18-2011 at 03:06 PM.

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,608

    Re: If >=0 and sumif or sumproduct

    The best way to get rid of the 0 is to hide it by formatting the result cells as Custom: 0;-0;;@
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: If >=0 and sumif or sumproduct

    My problem is sometimes 0 can be a valid answer, so if I edit the custom formatting the 0 would not appear

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,608

    Re: If >=0 and sumif or sumproduct

    Try:

    =IF(AND(INDEX(Inventory!$C$2:$C$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))="",INDEX(Inventory!$D$2:$D$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))=""),"",SUMPRODUCT(--(Inventory!$C$2:$C$7<>""),--(Inventory!$D$2:$D$7<>""),--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$C$2:$C$7+Inventory!$D$2:$D$7))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Registered User
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: If >=0 and sumif or sumproduct

    That's perfect,, how would I change the code, if they provide me a value in one of the columns out of the two to find the sum.
    Attached Files Attached Files
    Last edited by Jerseynjphillypa; 10-20-2011 at 01:37 PM.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,608

    Re: If >=0 and sumif or sumproduct

    Perhaps?

    =IF(AND(INDEX(Inventory!$C$2:$C$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))="",INDEX(Inventory!$D$2:$D$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))=""),"",SUMPRODUCT(--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$C$2:$C$7)+SUMPRODUCT(--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$D$2:$D$7))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Registered User
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: If >=0 and sumif or sumproduct

    What if there is text in the field. How do I prevent it from saying 0 since that's not a valid value for text. I

    I'm using this formula to sum up 4 columns together, two columns together and then comparing their values against one another. How can I run the if statement only if there are sums to add up that is greater or equal to 0.
    Last edited by Jerseynjphillypa; 10-20-2011 at 03:12 PM.

+ 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