+ Reply to Thread
Results 1 to 7 of 7

Conditional SumProduct

  1. #1
    Forum Contributor
    Join Date
    07-01-2005
    Posts
    103

    Conditional SumProduct

    I have a spreadsheet set up with 3 columns, A,B and C.
    Data in column A is a day of the week, while B and C are numbers.

    I need a formula that sums the product(B*C) for one particular day of the week. I would like to do this without first calculating the product in a fourth column.
    Any ideas?
    TIA, Paul.

  2. #2
    Forum Contributor
    Join Date
    07-01-2005
    Posts
    103
    Got it.
    =SUMPRODUCT(--(C2:C21="Monday")*(D2:D21)

    This is an adaption of VBA Noob's answer to an earlier question.

    I'm not sure how it works, (--)? but it seems to create an array of some sort.
    A quick explanation would be nice, but not necessary if you don't feel like handholding.
    Thanks again.

  3. #3
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Paul987
    I have a spreadsheet set up with 3 columns, A,B and C.
    Data in column A is a day of the week, while B and C are numbers.

    I need a formula that sums the product(B*C) for one particular day of the week. I would like to do this without first calculating the product in a fourth column.
    Any ideas?
    TIA, Paul.
    Hi,

    try

    =SUMPRODUCT(--(A1:A200=VALUE("01/01/2001"))*(B1:B200)*(C1:C200))

    hth
    ---amended, 2001"))*
    Si fractum non sit, noli id reficere.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Assuming that you have a day in text format in column A (not a formatted date)

    =SUMPRODUCT(--(A1:A100="Monday"),B1:B100,C1:C100)

  5. #5
    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,

    Try this

    =SUMPRODUCT(--(WEEKDAY(A2:A100)=2)*(B2:B100)*(C2:C100))

    Weekday 2 is a Monday

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Forum Contributor
    Join Date
    07-01-2005
    Posts
    103
    thanks for the help, guys.

  7. #7
    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
    Glad you got it working

    VBA Noob

+ 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