+ Reply to Thread
Results 1 to 8 of 8

Sumproduct Please Help!

  1. #1
    Registered User
    Join Date
    04-03-2006
    Posts
    11

    Question Sumproduct Please Help!

    I am trying to run a sumproduct formula and can't seem to get it right.

    I have daily cash activity listed in column A. Each day has several listings and different categories in column B. I have the amounts in column C.

    I want to run a calculation for one month's worth of days (column a) across one category (column b) using the amounts selected in columns A and B from column C.

    I thought the sumproduct formula would work, but I am stuck.

    Any ideas?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    It would of being helpful if you included a example with the ranges you wanted to look at.

    However this might get you started.

    =SUMPRODUCT(--(MONTH(A2:A10)=9)*(--(B2:B10="Category 1")*(--(C2:C10))))

    The formula is looking at

    Range (A2:A10) Change as required.
    that the month = Sept (9)
    and that the Range (B2:B10) Change as required
    is equal to "Category 1" Change to your criteria.
    Which then sums range (C2:C10) Change as required.
    which matches Sept and Category 1.

    VBA Noob

  3. #3
    Registered User
    Join Date
    04-03-2006
    Posts
    11
    I am not sure that will work. Here is a sample of the data:

    Column A Column B Column C
    02/01/06 Margin 100
    02/15/06 Sales 150
    02/20/06 Margin 175
    03/12/06 Sales 150
    03/15/06 Margin 125
    03/22/06 Margin 130

    I would like to sum the 'Margin' amounts for February dates only. Any thoughts?

  4. #4
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    It should work

    SUMPRODUCT((MONTH(A2:A10)=2)*(B2:B10="Margin")*(C2:C10))

    Following the adjustments suggested and assuming February does not exist in a previous year otherwise

    SUMPRODUCT((MONTH(A2:A10)=2)*(year(A2:A10)=2006)*(B2:B10="Margin")*(C2:C10))

    obviously you have to adjust the ranges, and the range cannot be a whole column.

    Regards

    Dav

  5. #5
    Registered User
    Join Date
    04-03-2006
    Posts
    11
    Thanks so much.

    However, I am getting a #VALUE! error. Any suggestions as to why that would happen?

  6. #6
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    The array arguments need to be the same size. If they aren't SUMPRODUCT will return the #VALUE! error. i.e. you can't use rows 1:10,1:11 and 1:10. They all need to be the same number of rows.

    HTH

    Steve

  7. #7
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    if anything evaluates as #value it will casue the formula to do the same

    does any of your source data contain #value!, do the list of values you wish to sum contain text?

    Are the dates text or date,, eg if you try to format them as numbers do they change or stay the same?

    regards

    Dav

  8. #8
    Registered User
    Join Date
    04-03-2006
    Posts
    11
    Thanks to all who helped!

    I figured it out with your help!!!!

+ 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