Consulting

Results 1 to 5 of 5

Thread: Sumproduct vs Ctrl+Shift+Enter arrays

  1. #1
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location

    Sumproduct vs Ctrl+Shift+Enter arrays

    Hi

    I use sumproduct a lot now when I need a query with multiple lookups. I learnt that here (thanks).

    The other guys in my team had never heard of sumproduct (not for that purpose anyhow) and always used Ctrl+Shift+Enter arrays to get the same result.

    What are the pros and cons of sumproduct vs other array types?
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    SUMPRODUCT doesn't need Ctrl-Shift-Enter (a big plus).

    SUMPRODUCT is marginally more efficient.

    There are some things that cannot be done with SUMPRODUCT. For instance, if you have a range that could have errors, to get the sum of values above 0 you would think you could use

    =SUMPRODUCT(--(NOT(ISERROR(A1:A20))),--(A1:A20>0),A1:A20)

    but all A1:A20 will register any errors, so the whole formula errors. But this array formula works fine

    =SUM(IF(NOT(ISERROR(A1:A20)),IF(A1:A20>0,A1:A20)))

    Get them all to read http://www.xldynamic.com/source/xld.SUMPRODUCT.html for a detailed explanation.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Thanks - and an excellent resource, by the way.
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Sir Babydum GBE
    Thanks - and an excellent resource, by the way.
    It's the best, no ands, no ifs, no buts
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Quote Originally Posted by xld
    It's the best, no ands, no ifs, no buts
    All kidding aside, it is the explanation that I refer everyone to.
    Regards,

    Patrick

    I wept for myself because I had no PivotTable.

    Then I met a man who had no AutoFilter.

    Microsoft MVP for Excel, 2007 & 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •