+ Reply to Thread
Results 1 to 15 of 15

Leaving cell blank when sumproduct result is 0

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    8

    Leaving cell blank when sumproduct result is 0

    I need help the following formula.

    =IF(SUMPRODUCT((Calculation!$C$4:$C$435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D$3:D$435<>""))=0,"",SUMPRODUCT((Calculation!C3:C435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D3:D435<>""),(Calculation!D3:D435)))

    I am getting the result as #N/A instead of blank cell.

    I am trying to get cell as blank when the result of the sumproduct is 0, I do not have the option of using another columns as I have only given columns to work with and this is an ongoing file which has data of several months.

    Any help would be appreciated.

    Thanks
    Ankur

  2. #2
    Forum Contributor dogberry's Avatar
    Join Date
    07-15-2012
    Location
    Wales, UK
    MS-Off Ver
    Excel 2010
    Posts
    624

    Re: Leaving cell blank when sumproduct result is 0

    Hi

    Try using iferror(your formula),"") not used 2003 but if you havent got iferror you must have something similar.

    Chris
    Click my star if I helped Thanks

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Leaving cell blank when sumproduct result is 0

    I think the reason you are getting the #N/A error is because your ranges are not of equal size - the first one is for C4:C435, but all the others are for rows 3 to 435. You might get other errors if any of those cells contain errors, but if they are clear of errors then your formula should work with that correction.

    Hope this helps.

    Pete

  4. #4
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Leaving cell blank when sumproduct result is 0

    =IF(SUMPRODUCT((Calculation!$C$4:$C$435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D$3:D$435<>""))=0,"",SUMPRODUCT((Calculation!C3:C435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D3:D435<>""),(Calculation!D3:D435)))
    Make sure all your ranges are the same size.

  5. #5
    Registered User
    Join Date
    11-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Leaving cell blank when sumproduct result is 0

    Thanks Pete & WHER for the quick reverts, I have made all ranges of the same size however I still get result as 0 and not blank cell.

  6. #6
    Registered User
    Join Date
    11-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Leaving cell blank when sumproduct result is 0

    Hi Chris,

    I tried iferror(your formula),"") and got a new error #NAME?

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Leaving cell blank when sumproduct result is 0

    There must be an error in your formula.

    Have you tried the SUMPRODUCT in a cell on it's own?
    If posting code please use code tags, see here.

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Leaving cell blank when sumproduct result is 0

    It might be that the sum of the appropriate cells in D3:D435 of the Calculation sheet is a very small number, but not equal to zero, and if you have the cell formatted to only show integer values then 0.1, 0.49999 etc will show as 0. Increase the number of decimal places on the cell where the formula is located to see what actual value you have.

    Hope this helps.

    Pete

    EDIT: IFERROR is not available in XL2003, so that is why you get the #NAME error. You would have to use ISNA or ISERROR to trap errors, but your formula is not now producing errors so you can ignore that for now.
    Last edited by Pete_UK; 11-21-2012 at 02:29 PM.

  9. #9
    Registered User
    Join Date
    11-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Leaving cell blank when sumproduct result is 0

    Upon your suggestion I did check the cell values of D3:D435, they are set at 0 decimal values. In case there is a value such as 0.49, 0.51 the result I am getting is 1 which is perfect however for values 0.00, 0.00 I am getting the result as 0.00 and I am looking for the cell as blank instead of a 0.

    Let me know if this is doable

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Leaving cell blank when sumproduct result is 0

    Well, you could try rounding the first part of your formula, like this:

    =IF(ROUND(SUMPRODUCT((Calculation!$C$3:$C$435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D$3:D$435<>"")),0)=0,"",SUMPRODUCT((Calculation!C3:C435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D3:D435<>""),(Calculation!D3:D435)))

    It's up to you if you want to also round the second part in the same way - it depends what you do with the returned values, and whether you want to treat them as integers or not in other calculations.

    Hope this helps.

    Pete

  11. #11
    Registered User
    Join Date
    11-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Leaving cell blank when sumproduct result is 0

    Pete,

    I am still getting the cell value as 0 when I want it to come blank.



    I am currently using Excel 2003 can i get the result I am looking for in Excel 2010
    Last edited by ankurkhandelwal1978; 11-21-2012 at 04:15 PM. Reason: additional comments

  12. #12
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Leaving cell blank when sumproduct result is 0

    not sure if this is the problem or not, but the sumproduct formula for your =0 is different than your formula for if it is not

    (check if = 0) SUMPRODUCT((Calculation!$C$3:$C$435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D$3:D$435<>""))
    (if not = 0 ) SUMPRODUCT((Calculation!C3:C435=MTD!C29)*(Calculation!A3:A435=MTD!B29)*(Calculation!D3:D435<>""),(Calculation!D3:D435))

    Hope this helps

    -Edit-
    this would result in a different calculation, thus the possibility of some "0"s that your trap doesn't catch
    Last edited by dredwolf; 11-21-2012 at 04:38 PM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  13. #13
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Leaving cell blank when sumproduct result is 0

    Yeah, well done dredwolf - you've nailed it. The first part of the OP's formula is just counting the columns that match the criteria (and returns a blank only if the count is zero), but then the second part sums the values from column D where there are matches, and from what he has said, these could be small values that look like 0 (or might even be zero) when displayed as integers.

    Pete

  14. #14
    Registered User
    Join Date
    11-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Leaving cell blank when sumproduct result is 0

    Thanks dredwolf and Pete,

    For your supper suggestions, finally I got what I was looking for based upon your suggestions I have made corrections to the formula and it works perfectly fine.

    Many thanks for got all the help

    the formula I am using now is

    =IF(SUMPRODUCT((Calculation!$C$3:$C$435=MTD!C$29)*(Calculation!A$3:A$435=MTD!B$29)*(Calculation!D$3:D$435))=0,"",SUMPRODUCT((Calculation!$C$3:$C$435=MTD!C$29)*(Calculation!A$3:A$435=MTD!B$29)*(Calculation!D$3:D$435<>" "),(Calculation!D$3:D$435)))

    and it workfs perfectly
    Last edited by ankurkhandelwal1978; 11-23-2012 at 01:44 PM. Reason: adding formula

  15. #15
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Leaving cell blank when sumproduct result is 0

    looks like you solved more than we did, I didn't even notice the Referencing issue !
    But Thanks

+ 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