Consulting

Results 1 to 13 of 13

Thread: Sum? sumif? sumproduct?

  1. #1

    Sum? sumif? sumproduct?

    I'm trying to figure out a formula to do what is shown in the pic if anyone can help.

    thanks

    Capture1.jpg

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    That note in AA22 doesn't make sense.

    There's no way to make any of those numbers in Z31:AF31 add up to 10.48/3
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    It will be lot better if you could upload the workbook instead of snapshot. For now, anyone wanting to help you needs to reconstruct the whole structure.
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  4. #4
    vbaexpress sample.xlsm
    sample sheet attached, that should make it clearer
    Quote Originally Posted by shrivallabha View Post
    It will be lot better if you could upload the workbook instead of snapshot. For now, anyone wanting to help you needs to reconstruct the whole structure.

  5. #5
    I think i've figured out something that works for me.

    =SUM((SUMIF(AH31:AH35,U9,AB31:AB35)*V9),(SUMIF(AH31:AH35,U10,AB31:AB35)*V10 ),(SUMIF(AH31:AH35,U11,AB31:AB35)*V11),(SUMIF(AH31:AH35,U12,AB31:AB35)*V12) )

    Seems a bit messy though if anyone know a way of refining it.
    Cheers

  6. #6
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    Following things are unclear to me
    - Is this formula for one cell only?
    - If not, can you demonstrate (manual) results for more than 1 columns or rows or whichever fashion you intend to implement? It will be easier to evaluate.

    Above result can be achieved using following ARRAY formula (to be committed by using CTRL+SHIFT+ENTER simultaneously)
    =SUM(((AB31:AB35)*TRANSPOSE(V9:V12))*ISNUMBER(SEARCH(AH31:AH35,TRANSPOSE(U9 :U12),1)))
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  7. #7
    i've updated the sheet with a bit more data and added the formulas into row 16.

    I tried the formula you posted which works to an extent, but it's picking the rows with blank cells and including them in the result.

    Cheers

    vbaexpress sample (1).xlsm
    Quote Originally Posted by shrivallabha View Post
    Following things are unclear to me
    - Is this formula for one cell only?
    - If not, can you demonstrate (manual) results for more than 1 columns or rows or whichever fashion you intend to implement? It will be easier to evaluate.

    Above result can be achieved using following ARRAY formula (to be committed by using CTRL+SHIFT+ENTER simultaneously)
    =SUM(((AB31:AB35)*TRANSPOSE(V9:V12))*ISNUMBER(SEARCH(AH31:AH35,TRANSPOSE(U9 :U12),1)))

  8. #8
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Maybe:

    =SUMPRODUCT((AH$31:AH$35=TRANSPOSE($U$9:$U$12))*$AB$31:$AB$35*TRANSPOSE($V$ 9:$V12))

    also array-entered.
    Be as you wish to seem

  9. #9
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    Quote Originally Posted by plasteredric View Post
    i've updated the sheet with a bit more data and added the formulas into row 16.

    I tried the formula you posted which works to an extent, but it's picking the rows with blank cells and including them in the result.

    Cheers

    vbaexpress sample (1).xlsm
    Here's SUM based one for copying across.
    =SUM((($AB$31:$AB$35)*TRANSPOSE($V$9:$V$12))*ISNUMBER(SEARCH(TRANSPOSE($U$9 :$U$12),AH31:AH35,1)))
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  10. #10
    Quote Originally Posted by Aflatoon View Post
    Maybe:

    =SUMPRODUCT((AH$31:AH$35=TRANSPOSE($U$9:$U$12))*$AB$31:$AB$35*TRANSPOSE($V$ 9:$V12))

    also array-entered.
    Worked great, is there a way of doing the same, but so that it calculates only visible(filtered) data?

    Cheers

  11. #11
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Add a column to the source data that uses SUBTOTAL on a column that is always populated (so it returns 1 for each visible row and 0 for hidden ones), then include that column in the multiplication.
    Be as you wish to seem

  12. #12
    Right, i've added column Z with the formula "=- -SUBTOTAL(103,Y31)" in cells Z31:Z35
    How do I then reference the column in this formula? "=SUMPRODUCT((AH$31:AH$35=TRANSPOSE($U$9:$U$12))*$AB$31:$AB$35*TRANSPOSE($V$ 9:$V12))"
    I've tried a couple of ways but I cant get it to work
    cheers

    Quote Originally Posted by Aflatoon View Post
    Add a column to the source data that uses SUBTOTAL on a column that is always populated (so it returns 1 for each visible row and 0 for hidden ones), then include that column in the multiplication.

  13. #13
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    It should be:

    =SUMPRODUCT((AH$31:AH$35=TRANSPOSE($U$9:$U$12))*$Z$31:$Z$35*$AB$31:$AB$35*TR ANSPOSE($V$9:$V12))
    Be as you wish to seem

Posting Permissions

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