+ Reply to Thread
Results 1 to 10 of 10

Sumproduct function to return blank instead of 0

  1. #1
    Registered User
    Join Date
    03-28-2010
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    38

    Sumproduct function to return blank instead of 0

    Excel Gurus please help -

    I'm using a if(sumproduct) function on my workbook which works fine. But the only problem that I have is I want the formula to return "blank" instead of $0.00.

    Can someone please help me solve this mystery. My formula is given below -

    =IF($P19="BE",SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*(Billing_Rate)),SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*(Avg_Rate)))/1000000

    Regards,
    Sunil

  2. #2
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Sumproduct function to return blank instead of 0

    Hi Sunil,

    Go to the number formatting, if you are using currency, choose the Category: Custom

    This should appear in Type: _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)

    Change it to this instead... _($* #,##0.00_);_($* (#,##0.00);;

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sumproduct function to return blank instead of 0

    An IF/OR in front of your formula??

    =IF(OR(SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*(Billing_Rate))=0,SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*(Avg_Rate)))/1000000
    =0),"",IF($P19="BE",SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*(Billing_Rate)),SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*(Avg_Rate)))/1000000
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Sumproduct function to return blank instead of 0

    =if(SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*IF($P19="BE",(Billing_Rate),(Total_Hours)*(Avg_Rate)/1000000))=0,"",SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7)*(Total_Hours)*IF($P19="BE",(Billing_Rate),(Total_Hours)*(Avg_Rate)/1000000))
    Quang PT

  5. #5
    Registered User
    Join Date
    03-28-2010
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Sumproduct function to return blank instead of 0

    Hi djapigo,

    I tried using the custom format that you suggested but I get a space between the $ and amount like this - $ 0.30. There should not be any space between the $ and the amount. I tried playing around with it but could not get it to work. Can you please help me fix this?

  6. #6
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Sumproduct function to return blank instead of 0

    Try this...
    _($#,##0.00_);_($(#,##0.00);;

    Remove the * and 'space' on both (note: "* space" means repeat the space until the whole cell is filled in)

    Quick lesson: number formatting has 4 types (separated by semicolon) positive;negative;zero;text
    Each type is the format of how you want it to look like... (see number formatting in the help section)

    The reason why 0's are not showing up is that we "removed" the format... hence the 2 semicolons at the end...

    Hope this helps...

  7. #7
    Registered User
    Join Date
    03-28-2010
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Sumproduct function to return blank instead of 0

    Fantastic djapigo. I'll surely spend some time tonight on the number formatting in the help section.

    Thanks so much.

  8. #8
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Sumproduct function to return blank instead of 0

    No problem... glad to help...

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sumproduct function to return blank instead of 0

    You could shorten the original formula by embedding the IF function in the relevant part of SUMPRODUCT, i.e.

    =SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7),Total_Hours,IF($P19="BE",Billing_Rate,Ave_Rate))/1000000

    Then if you want blank instead of zero you could force an error for zero (#DIV/0!) and use IFERROR to generate a blank instead, i.e.

    =IFERROR(1/(1/SUMPRODUCT((Work_Num=$O19)*(Wk_Ending_Dt=V$7),Total_Hours,IF($P19="BE",Billing_Rate,Ave_Rate)))/1000000,"")
    Audere est facere

  10. #10
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Sumproduct function to return blank instead of 0

    daddylonglegs,

    I really like your "force an error for zero"... very clever!

+ 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