+ Reply to Thread
Results 1 to 9 of 9

how to combine sumproduct and countif without adding the two of them

  1. #1
    Registered User
    Join Date
    12-15-2012
    Location
    France
    MS-Off Ver
    Excel 2010
    Posts
    4

    how to combine sumproduct and countif without adding the two of them

    Hello,

    I'm having problems with my formula. Here it is :

    =SUMPRODUCT((('tableau de bord'!$E$3:$E$269="M1")+('tableau de bord'!$E$3:$E$269="M1 F1")+('tableau de bord'!$E$3:$E$269="M1 F2")+('tableau de bord'!$E$3:$E$269="M1 F3")+('tableau de bord'!$E$3:$E$269="Non")+('tableau de bord'!$E$3:$E$269="SO"))*(('tableau de bord'!$AC$3:$AC$269="Autorisé le")+('tableau de bord'!$AC$3:$AC$269="Envoyé le")+('tableau de bord'!$AC$3:$AC$269="Non Autorisé")+('tableau de bord'!$AC$3:$AC$269="Reconduit le"))*(('tableau de bord'!$AK$3:$AK$269="exploité")+('tableau de bord'!$AK$3:$AK$269="secours")))*(COUNTIF('tableau de bord'!AN3:AN269;"*/ 3 /*"))

    The formula seems good but the problem is that sumproduct and countif multiply together.
    I just want countif to be another filter. Can you help me ?

    Thank you very much.
    Last edited by Mushette; 12-15-2012 at 03:50 PM.

  2. #2
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: how to combine sumproduct and countif without adding the two of them

    you are missing one bracket in the right place (hence the multiplicative effect), and also, i think, you want to use COUNTIF to ascertain the existence of a string in a cell, so:

    =SUMPRODUCT((('tableau de bord'!$E$3:$E$269="M1")+('tableau de bord'!$E$3:$E$269="M1 F1")+('tableau de bord'!$E$3:$E$269="M1 F2")+('tableau de bord'!$E$3:$E$269="M1 F3")+('tableau de bord'!$E$3:$E$269="Non")+('tableau de bord'!$E$3:$E$269="SO"))*(('tableau de bord'!$AC$3:$AC$269="Autorisé le")+('tableau de bord'!$AC$3:$AC$269="Envoyé le")+('tableau de bord'!$AC$3:$AC$269="Non Autorisé")+('tableau de bord'!$AC$3:$AC$269="Reconduit le"))*(('tableau de bord'!$AK$3:$AK$269="exploité")+('tableau de bord'!$AK$3:$AK$269="secours"))*(COUNTIF('tableau de bord'!AN3:AN269;"*/ 3 /*")>0))

    there is no way for me to test this, so the onus is on you.

    also, if you share your (sample) workbook, i am quite sure your formula can be simplified to a much greater extent.

    UPDATE:

    try replacing (COUNTIF('tableau de bord'!AN3:AN269;"*/ 3 /*")>0) with (isnumber(search("*/ 3 /*";'tableau de bord'!AN3:AN269)))...
    Last edited by icestationzbra; 12-15-2012 at 02:47 PM.
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: how to combine sumproduct and countif without adding the two of them

    Untested..

    Please Login or Register  to view this content.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Registered User
    Join Date
    12-15-2012
    Location
    France
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: how to combine sumproduct and countif without adding the two of them

    Thank you for your replies.

    Here is a sample workbook (I'm working on a bigger one for my company which contains something like 40 columns and 270 lines).
    On the sample I only put the columns on which I want to do the filter.



    icestationzbra, I tried your formula but it doesn't give me the result I'd like to have.
    I don't want to ascertain the existence of a string in a cell for the last part of the formula. I just want the last part to be another filter but I don't know if it is possible to add another sumproduct part to the whole thing.

    Ace_XL, I tried yours as well but it doesn't work, it seems that Excel doesn't understand the "{" .


    Hmm, I know the last column is kind of a mess but I cannot make it better, I only want to take what contains "/ 3 /"

    Thanks
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-15-2012
    Location
    France
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: how to combine sumproduct and countif without adding the two of them

    Well, I just discovered that the column C was missing three values in the formula because lines 261,262,263 appeared with a space behind the word...

    But that last part of the formula still doesn't work.

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: how to combine sumproduct and countif without adding the two of them

    Ice's formula works..see attached
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-15-2012
    Location
    France
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: how to combine sumproduct and countif without adding the two of them

    Indeed, I tried it all again on my own !

    Thank you very much, you guys are genius

  8. #8
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: how to combine sumproduct and countif without adding the two of them

    simplified, abridged, formula for the sample you provided in post #4:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    alternatively, Pivot Table can also be used for this purpose, see attached.
    Attached Files Attached Files
    Last edited by icestationzbra; 12-17-2012 at 11:02 AM. Reason: spell check

  9. #9
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: how to combine sumproduct and countif without adding the two of them

    i had been attempting to solve this problem using Database functions, and seem to have succeeded with the help of some reference material from Bill Jelen. Database functions are purported to have better performance, compared to SUMPRODUCT and the like, over large ranges of data.

+ 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