+ Reply to Thread
Results 1 to 12 of 12

SumProduct - Average

  1. #1
    Registered User
    Join Date
    04-08-2008
    Posts
    18

    SumProduct - Average

    Does anyone out there know the quivalent formula to return average rather than sum as it does in sumproduct.

    I'm after an array formula without using the 'control, shift and enter' route. This is because these type of formula's take a vast amount of CPU resources when you start building them up and limited to the number of arrays (whereas there are 30 available in sumproduct)

    Sumproduct reduces the resource by 20% which is great, but i'd want an Avgproduct (although i know that doesn't technical exsist).

    I also don't want to go down the route of using a /countif formula to get an average as this will ensure the formual becomes very large as i've got a number of columns in my array to start with.

    Anyone got any ideas? (not including VB).

    Thanks

    Steve

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: SumProduct - Average

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  3. #3
    Registered User
    Join Date
    04-08-2008
    Posts
    18

    Re: SumProduct - Average

    I've attached a test sheet showing what sumproduct is doing which works fine when i need a sum, but want the same sort of formula to return the average.

    Thanks

    Steve
    Attached Files Attached Files

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

    Re: SumProduct - Average

    How about Pivot table?

    Also, you didn't write a excel version since in XL 2007 and on you could use =AVERAGEIFS function
    Attached Files Attached Files
    Never use Merged Cells in Excel

  5. #5
    Registered User
    Join Date
    04-08-2008
    Posts
    18

    Re: SumProduct - Average

    Quote Originally Posted by zbor View Post
    How about Pivot table?

    Also, you didn't write a excel version since in XL 2007 and on you could use =AVERAGEIFS function
    Thanks, but that wouldn't suit the format that i need. I can't attach the sheet i'm currently using arrays as there is a mass of data on it.

    Thanks
    Steve

  6. #6
    Registered User
    Join Date
    04-08-2008
    Posts
    18

    Re: SumProduct - Average

    Sorry i forgot to say i'm using 2003 and so is the business i'm working at. I've seen the new formula's in 2007, but can't use them.

    Thanks

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

    Re: SumProduct - Average

    Only AVERAGEIFS function meet you request.

    Anything else is either SUMPRODUCT either ARRAY function.

    To avoid it you can use Pivot table or Filter as in example.

    Filter your values and you'll get required numbers.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-08-2008
    Posts
    18

    Re: SumProduct - Average

    Quote Originally Posted by zbor View Post
    Only AVERAGEIFS function meet you request.

    Anything else is either SUMPRODUCT either ARRAY function.

    To avoid it you can use Pivot table or Filter as in example.

    Filter your values and you'll get required numbers.
    That's a shame, filter/pivot wouldn't work as the attached sheet is just a dummy and nothing like the final version which has multiple tabs and formulas across it rather than looking at the data tab.

    Thanks

    Steve

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: SumProduct - Average

    Then try to reduce number of volatile formulas and keep ranges to minimum...
    (use for example A1:A1000 instead of A:A)

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: SumProduct - Average

    Use concatenation to create a unique key - you can then avoid SUMPRODUCT/Array by virtue of a SUMIF/COUNTIF (utilising wildcards as nec.)

    Using your sample file to illustrate concept:

    Data!E2:
    =":"&B2&"::"&C2&":"
    copied down

    Sheet1!B5:
    =SUMIF(Data!$E:$E,":HR::1:",Data!$D:$D)

    Sheet1!B9
    =B5/COUNTIF(Data!$E:$E,":HR::1:")

    A greater number of lightweight calcs (as above) will perform far better than Array/SUMPRODUCT equivalents - esp. when used in conjunction with large datasets.

  11. #11
    Registered User
    Join Date
    04-08-2008
    Posts
    18

    Re: SumProduct - Average

    Quote Originally Posted by DonkeyOte View Post
    Use concatenation to create a unique key - you can then avoid SUMPRODUCT/Array by virtue of a SUMIF/COUNTIF (utilising wildcards as nec.)

    Using your sample file to illustrate concept:

    Data!E2:
    =":"&B2&"::"&C2&":"
    copied down

    Sheet1!B5:
    =SUMIF(Data!$E:$E,":HR::1:",Data!$D:$D)

    Sheet1!B9
    =B5/COUNTIF(Data!$E:$E,":HR::1:")

    A greater number of lightweight calcs (as above) will perform far better than Array/SUMPRODUCT equivalents - esp. when used in conjunction with large datasets.
    That works up to the point where you are using lookup values to change the result. For example i'd have a lookup with all department names in and when one is selected it's used in the formula and returns X result. Concatenation would result in my having to use that value in the lookup rather than the actual name of the department.

    There is some fiddly bits of work i could do to get it to point where i want, but probably worth just looking at office 2007.

    Thanks

  12. #12
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: SumProduct - Average

    No need to quote entire posts in your reply this simply clutters up the thread.

    I'm afraid I don't really follow what you're saying in the above ... or rather I don't understand the significance.

    If the department is a variable then modify the criteria in the SUMIF/COUNTIF accordingly, eg:

    =SUMIF(Data!$E:$E,":"&$A$1&"::"&$B$1,Data!$D:$D)
    where A1 / B1 hold the "variables"

    the key is not affected in any way, shape or form.

    edit:
    On an aside, if you find yourself using a model in which calculating time is oppressive then that's normally a fairly good indication that the model needs to be redesigned.
    Last edited by DonkeyOte; 07-13-2010 at 08:17 AM.

+ 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