+ Reply to Thread
Results 1 to 27 of 27

SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Dear Forum,

    This might be oft-repeated topic however, it seems endless about the mysteries of the venerable SUMPRODUCT and the Array Formulas..
    I personally favour the Sumproduct however there are so many hidden aspects which remain unconquered..

    I downloaded a file from the Cpearson website for ArraY formulas where the Array Formula is explained as a Stand-ALone but I want to why should we prefer the former and the latter and when?

    http://www.cpearson.com/excel/ArrayFormulas.aspx

    I am up-loading a File from the website for Array Formulas where I have added the same answers usin a SUMPRODUCT but in certain cases , I am pretty confused though I managed to get the same answers..

    So, please can someone help me with this..!

    Warm Regards
    e4excel
    Attached Files Attached Files
    Last edited by Paul; 03-29-2012 at 02:25 PM.

  2. #2
    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 Vs ARRAY FORMULAS, which is the best and why?

    Hi

    As i know, these years that i use Excel, there is a rule.

    If you find a solution WITHOUT array formula, then do it!!
    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.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    SUMPRODUCT is also array formula, only don't need to be entered with ctrl+shift+enter.

    So efficiency is same and that's why array formula must be avoided (if possible) or keeped in minimum ranges.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Formula for logical XOR is correct and 5 is right answer because it don't consider result in row 3 (Fax - Jones - 20)

    Edit: You mean for other part...

    Maybe something like this: =SUMPRODUCT(((A2:A10="Fax")+(B2:B10="Jones")-2*(B2:B10="Jones")*(A2:A10="Fax")))
    Last edited by zbor; 03-16-2012 at 06:11 AM.

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Actually, I am doubting all my formulas marked in yellow..
    In SUMPRODUCT We can never just check within the conditions whether it more than once or not..

    Ex: As per the Title for the Logical OR ( Faxes or Jones) I thought its just saying that either of them but its meant to have just either of them and not both of them, Correct

    So I modified my SUMPRODUCT formula this way:

    PHP Code: 
    =SUMPRODUCT(((A2:A10="Fax")*(B2:B10<>"Jones"))*(A2:A10="Fax")+(B2:B10="Jones"))

    where I check that the combination of both is not present at the same time ((A2:A10="Fax")*(B2:B10<>"Jones"))
    and 
    then the regular either of them.. *(A2:A10="Fax")+(B2:B10="Jones"

    Now for me the LOGICAL XOR also seems to be the same as above..and still getting confused with the last requirement, though I managed to TALLY the answers without understanding the query correctly , I need to understand the subjective part which exact combinations are counted..

  6. #6
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Totally confused now, I dont know how to get the last condition for NAND?

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Like this?

    =SUMPRODUCT(--(A2:A10&B2:B10<>"FaxJones"))

  8. #8
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Zbor,

    I would really appreciate if you could explain me the requirements from LOGICAL OR till LOGICAL NAND..
    Actaully, I am not able to understand which ones are considered for what?

    Seriously, it would be great help..

    Thanks in advance..

  9. #9
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Bump NO Response

    Bump NO Response

  10. #10
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Bump No Response

    Bump No Response

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    For the XOR:

    =SUMPRODUCT((((A2:A10="Fax")*(B2:B10<>"Jones")+(A2:A10<>"Fax")*(B2:B10="Jones"))))
    Where there is a will there are many ways.

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

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

  12. #12
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    YOu are a Saviour...

    HOnestly speaking, I felt I was actually coming to terms with the SUMPRODUCT formula until I ventured into this file..
    I actually dont understand what the question is ?

    1. Summing Sales: Faxes Sold By Brown

    My Understanding- Total Units -Only Faxes and Sold by Mr Brown..
    PHP Code: 
    =SUMPRODUCT((A2:A10="Fax")*(B2:B10="Brown")*(C2:C10)) 
    2.Logical AND (Faxes And Jones)its mentioned incorrectly should be Mr Brown.

    My Understanding- Count -Only Faxes and Sold by Mr Brown..
    PHP Code: 
    =SUMPRODUCT((A2:A10="Fax")*(B2:B10="Brown")) 
    Now, I am going Bonkers over here..

    3. Logical OR (Faxes Or Jones)
    PHP Code: 
    Original Formula- {=SUM(IF((A2:A10="Fax")+(B2:B10="Jones"),1,0))} 
    My Understanding- Get the Count where the Product is Fax or the Person is Jones

    4. Logical XOR (Fax Or Jones but not both)
    PHP Code: 
    Original Formula- {=SUM(IF(MOD((A2:A10="Fax")+(B2:B10="Jones"),2),1,0))} 
    My Understanding- I dont know ?

    5. Logical NAND (All Sales Except Fax And Jones)
    PHP Code: 
    Original Formula- {=SUM(IF((A2:A10="Fax")+(B2:B10="Jones")<>2,1,0))} 
    My Understanding- I dont know ?

    CAn you please explain ..

    Warm REgards
    e4excel

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    You have sumproduct formulas that work. You want to know how the SUM(IF( arrays would work?

    They work the same as the SUMPRODUCTs except you have to confirm with CSE.

    Incidentally, the XOR Sumproduct could be written as the SUM(IF... i.e. =SUMPRODUCT(--(MOD((A2:A10="Fax")+(B2:B10="Jones"),2)))

  14. #14
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    No i am not actuallt talking about Formulas at all, I have just tried different combinations and matched the results which according tome is not a good approach..

    I mean what do the questions mean? as I have this file I am taking it as a reference:

    Logical OR (Faxes Or Jones)


    Logical XOR (Fax Or Jones but not both)


    Logical NAND (All Sales Except Fax And Jones)

    Pretty confused as to what is asked?

  15. #15
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    So you want to know what this: "Logical AND (Faxes And Jones)" means? I don't know if I am following you....

  16. #16
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Yes exactly ..! as in the original formulas they have used the If condition with 1 and 2..
    I have got completely confused , if I dont understand the requirement in words how will i build the criterias in the SUMPRODUCT?

    I JUST FIBBED the results or just manipulated the answers but actually did not understand why it was so?

    OR is meant like this or that..!

    Just provide me an explanation please alingwith the SUMPRODUCT code..

    Warm Regards
    e4excel

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    With Sumproduct and Array formulas, the + sign is used for OR and the * is used for AND.... so you have to figure out the right one and/or combination to get the result you are intending....

    Order of operations is important... * (AND) gets processed before + (OR) so if you want the + processed first, you need to enclose the argument in parentheses, like in normal math...

  18. #18
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Quote Originally Posted by NBVC View Post
    With Sumproduct and Array formulas, the + sign is used for OR and the * is used for AND.... so you have to figure out the right one and/or combination to get the result you are intending....

    Order of operations is important... * (AND) gets processed before + (OR) so if you want the + processed first, you need to enclose the argument in parentheses, like in normal math...
    The Precedence of "*" before "+" was something I did not know..

    But I really meant to understand More about the XOR and NAND Logical Explanation as to what exactly they do, its just not excel formula but I needed to understand the LOGICAL gates..

    Is XOR like NOT(OR)
    IS NAND like NOT(AND)

    Would really appreciate if you could explain me the Present examples for just the three conditions with the regular C+S+E and SUMPRODUCT formula..

    Warm REgards
    e4excel

  19. #19
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Quote Originally Posted by NBVC View Post
    So you want to know what this: "Logical AND (Faxes And Jones)" means?
    Yeah exactly

  20. #20
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    I am not a Mathematician, (maybe shg can better explain)... but here are some definitions I found:

    AND:

    A connective in logic which yields true if all conditions are true, and false if any condition is false.

    OR:

    A connective in logic which yields true if any one of a sequence conditions is true, and false if all conditions are false. In formal logic, the term disjunction (or, more specifically, inclusive disjunction) is commonly used to describe the OR operator.

    NAND:

    also known as the Sheffer stroke, is a connective in logic equivalent to the composition NOT AND that yields true if any condition is false, and false if all conditions are true

    XOR:

    A connective in logic known as the "exclusive or," or exclusive disjunction. It yields true if exactly one (but not both) of two conditions is true.

    These are all taken from this website: Wolfram MathWorld

    I hope that helps.

  21. #21
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Quote Originally Posted by NBVC View Post

    AND:

    A connective in logic which yields true if all conditions are true, and false if any condition is false.

    OR:

    A connective in logic which yields true if any one of a sequence conditions is true, and false if all conditions are false. In formal logic, the term disjunction (or, more specifically, inclusive disjunction) is commonly used to describe the OR operator.

    NAND:

    also known as the Sheffer stroke, is a connective in logic equivalent to the composition NOT AND that yields true if any condition is false, and false if all conditions are true

    XOR:

    A connective in logic known as the "exclusive or," or exclusive disjunction. It yields true if exactly one (but not both) of two conditions is true.
    Thanks again NBVC for the Mathematical definitions..but when I tried to interpret the same in the SUMPRODUCT I couldt quite do the same, lets take OR Gate for example :

    The Question was
    3. Logical OR (Faxes Or Jones)

    PHP Code:
    Original Formula- {=SUM(IF((A2:A10="Fax")+(B2:B10="Jones"),1,0))}
    My Understanding- Get the Count where the Product is Fax or the Person is Jones
    As I mentioned Fibbed the answers, but in my mind, I was thinking of putting this in SUMPRODUCT..

    Please Login or Register  to view this content.
    so that its either Fax or Jones now when I look at the answer its 7 whereas the one given in the file is 6..

    So I didnt understand that? I am really sorry that I have kep this query still open but honestly I am still unsure when I look at the examples..especially these should be something I must be good at..!

    I am not able to exactly convey but I think its the interpretaion of the LOGICAL GATES in that example that I am finding difficult..

    IF OR was only about getting either one of the said variables as FALSE then why does the SUMPRODUCT change..? Or is it that the SUMPRODUCT all the results seperately and therefore we need to remove that condition from the SUMPRODUCT ?

    So can you please provide me the answers with the SUMPRODUCT formula and with some explanation from which I can explain my DUMB head..

    Thanks...

  22. #22
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    In one case you have Fax and Jones in the same line... which would result in 2 TRUE's for the line (when you add the Separate TRUE/FALSE result arrays...

    In the SUMIF, you are saying to SUM a 1 for each time you have a non-zero results in the SUM(IF()) ... so wether the result is 1 or 2, you are adding a 1 for each...

    To do the same with SUMPRODUCT: You need to tell it to make each non 0 result equivalent to 1.. so adding >0 (results in TRUE) and coercing it with the -- or +0, will sum 1's for each "TRUE" result...

    Note: THE + is still "adding" the arrays, but it allows you to "add" if either of your conditions are true...

    =SUMPRODUCT(--((A2:A10="Fax")+(B2:B10="Jones")>0))

  23. #23
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Use the formula evaluator audit tool in each case to follow the logic.

  24. #24
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Bump NO Response

    Thanks a lot NBVC for the explanation that helps and I am still re-reading it...

    But does the XOR mean (that either but not both) and NAND mean (that all except the given conditions)

    Sorry I am still taking time but I really do appreciate your patience..

    Thanks again..

  25. #25
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    NAND means Not And; it is the inverted output of an And gate.

    Similarly, NOR is the inverted output of an Or gate.
    Entia non sunt multiplicanda sine necessitate

  26. #26
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Quote Originally Posted by shg View Post
    NAND means Not And; it is the inverted output of an And gate.

    Similarly, NOR is the inverted output of an Or gate.
    NO SHG, its easier said than done when it comes to interpreting with Data.. I am talking about my own self..
    I am somehow finding it still difficult to explain what I am not following as I understand that its NOT(OR) & NOT(AND)..
    But in the example when I say XOR and NAND I get confused..

    e4excel
    Last edited by e4excel; 03-30-2012 at 01:20 PM.

  27. #27
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: SUMPRODUCT Vs ARRAY FORMULAS, which is the best and why?

    Google boolean algebra

+ 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