+ Reply to Thread
Results 1 to 11 of 11

Sumproduct to ignore blanks

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Sumproduct to ignore blanks

    Hi All

    Can anybody help me adjust the following SUMPRODUCT formula to ignore any blanks in column B?

    =SUMPRODUCT($B$5:$B$4000,$S$5:$S$4000)/SUM($S$5:$S$4000)
    I am using the formula above to calculate a weighted average, and am open to using other functions if anybody has any more efficient suggestions?

    Any help would be greatly appreciated
    Last edited by Dgp2012; 10-21-2013 at 11:40 AM.

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Sumproduct to ignore blanks

    Hello Dgp try this =SUMPRODUCT(IF(($B$5:$B$4000)<>0,($B$5:$B$4000)*($S$5:$S$4000)/SUM($S$5:$S$4000)))
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Registered User
    Join Date
    08-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Sumproduct to ignore blanks

    Hi Hemesh

    Thanks for your swift response.

    Unfortunately this has returned the #VALUE error. I also tried to exclude empty cells this way (<>"") but no luck...

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Sumproduct to ignore blanks

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Registered User
    Join Date
    08-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Sumproduct to ignore blanks

    Sample workbook attached...
    Attached Files Attached Files

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sumproduct to ignore blanks

    Hi,

    Perhaps:

    =SUMPRODUCT($B$3:$B$16,--($B$3:$B$16<>0),$S$3:$S$16)/SUMPRODUCT($S$3:$S$16,--($B$3:$B$16<>0))

    Regards
    Click * below if this answer helped

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

  7. #7
    Registered User
    Join Date
    08-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Sumproduct to ignore blanks

    Fantastic! Thanks very much for your help

    I made a very slight adjustment to suit the blank cells; instead of using <>0, I used <>"".

    Thanks again

    DGP

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sumproduct to ignore blanks

    You're welcome.

  9. #9
    Registered User
    Join Date
    12-16-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    1

    Re: Sumproduct to ignore blanks

    Many years later:
    I need some help!

    =SUMPRODUCT($C$12:$K$12, 1/$C$13:$K$13, C19:K19)
    Sum product(Weightage, Max marks, Student score)
    I need it to ignore the empty cells otherwise it gives a zero answer.

    Can you help? I can't seem to figure out how to adapt your previously posted solution to mine.

    Thanks in advance!

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sumproduct to ignore blanks

    Quote Originally Posted by raheeljessa View Post
    Many years later:
    I need some help!

    =SUMPRODUCT($C$12:$K$12, 1/$C$13:$K$13, C19:K19)
    Sum product(Weightage, Max marks, Student score)
    I need it to ignore the empty cells otherwise it gives a zero answer.

    Can you help? I can't seem to figure out how to adapt your previously posted solution to mine.

    Thanks in advance!
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  11. #11
    Registered User
    Join Date
    03-16-2020
    Location
    OKC
    MS-Off Ver
    2016
    Posts
    1

    Re: Sumproduct to ignore blanks

    raheeljessa, I had the same question! Including --([array]<>0) doesn't work if you need to manipulate an array within the sumproduct calculation like you and I need to. I searched for your name in this forum but you never reposted your question.

    The solution below works for me. My data is listed in columns, with blanks sorted to the bottom. My total number of blanks varies with other inputs.

    Say SUMPRODUCT(1/A1:A999) ignoring blanks is what you want. First sort the blanks to the bottom either with filters or another formula. Then use:

    SUMPRODUCT(1/(A1:INDEX(A1:A999,COUNT(A1:A999))))

    Unfortunately if you want to use other arrays in the sumproduct, they'll need to be the same size. For example, to include B1:B999, the sumproduct will look like this:

    SUMPRODUCT(1/(A1:INDEX(A1:A999,COUNT(A1:A999))),B1:INDEX(B1:B999,COUNT(A1:A999)))

    Using your example and switching to lists in rows:

    SUMPRODUCT($C$12:INDEX($C$12:$K$12,1,COUNTIF($C$13:$K$13,"<>0")),1/($C$13:INDEX($C$13:$K$13,1,COUNTIF($C$13:$K$13,"<>0"))),C19:INDEX($C$19:$K$19,1,COUNTIF($C$13:$K$13,"<>0")))

    It's ugly but it works for me. If you can't filter the 0s to the right, I would recommend transposing to columns so you can easily work with filters. If you think of a more elegant solution please share.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] MIN/MAX IF To Ignore Blanks
    By splendidus in forum Excel General
    Replies: 2
    Last Post: 07-04-2012, 04:00 PM
  2. Ignore blanks in sumproduct formula
    By Rhyl in forum Excel General
    Replies: 4
    Last Post: 02-02-2012, 11:42 AM
  3. Concatenate and ignore blanks
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 09-24-2009, 11:23 AM
  4. Concatenate and ignore blanks
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2009, 04:25 AM
  5. SUMPRODUCT - 3 columns, 1 cell and ignore blanks
    By raehippychick in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-11-2007, 07:36 AM

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