+ Reply to Thread
Results 1 to 10 of 10

sumproduct() formula construction

  1. #1
    Registered User
    Join Date
    01-27-2008
    Location
    Dorset, UK
    Posts
    63

    sumproduct() formula construction

    I have a table (lets say 100 rows):
    Column A has a 6 digit code
    Column B has a month number (1-12)
    Column C has a date
    Column D has a value

    I'm trying to construct the formula so that I can add up all the values for dates that fall within a month, for the sake of example Jan-17 i.e. 42736 and 42766.
    It's the range piece that I don't know how to syntax.

    I guess it would look like =SUMPRODUCT((A1:a1000=6 digit code)*(b1:b1000=Month Number)*(??????????)*(D1:D1000)

    Can anyone help with the ???????

    Thanks in advance

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sumproduct() formula construction

    Perhaps

    =SUMPRODUCT((A1:a1000=6 digit code)*(Month(b1:b1000)=Month Number)*(D1:D1000))

    Text values in B will cause this to error, so you might skip the Header Row 1
    And blanks will be considered January, so may need to add a criteria for B<>""

  3. #3
    Registered User
    Join Date
    01-27-2008
    Location
    Dorset, UK
    Posts
    63

    Re: sumproduct() formula construction

    Yes, I was forgetting about the header row, good point.
    Can you expand on this criteria you mentioned - how would that look within the sumproduct() formula? Apologies for my ignorance, I'm new to this formula.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sumproduct() formula construction

    =SUMPRODUCT((A2:a1000=6 digit code)*(Month(b2:b1000)=Month Number)*(D2:D1000)*(b2:b1000<>""))

    That last criteria is only needed IF you have blank cells in column B, AND you're using 1 (for January) as the Month Number

  5. #5
    Registered User
    Join Date
    01-27-2008
    Location
    Dorset, UK
    Posts
    63

    Re: sumproduct() formula construction

    Thanks for the information, that's great. One last question, if I wanted to sum the values based on two dates that were in different months, let's say between 1/15/2017 and 2/15/2017 (42750 & 42781 respectively), how would I need to change the formula?

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sumproduct() formula construction

    Try
    =SUMPRODUCT((A2:a1000=6 digit code)*(c2:c1000>=42750)*(c2:c1000<=42781)*(D2:D1000))

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: sumproduct() formula construction

    Use cells to hold the criteria...

    F2 = 6 digit code
    G2 = start date
    H2 = End date

    Then:

    =SUMIFS(D2:D1000,A2:A1000,F2,C2:C1000,">="&G2,C2:C1000,"<="&H2)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Registered User
    Join Date
    01-27-2008
    Location
    Dorset, UK
    Posts
    63

    Re: sumproduct() formula construction

    Jonmo1, I think you've cracked it for me, this looks like the solution. I'm very grateful for your input and advice.
    Tony - your solution works too.
    Gentlemen, thank you both.

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sumproduct() formula construction

    You're welcome.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: sumproduct() formula construction

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula construction challenge
    By Saturn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2014, 01:48 PM
  2. [SOLVED] Efficient Array Formula Construction
    By Mike Moore in forum Excel General
    Replies: 8
    Last Post: 07-23-2006, 07:37 PM
  3. formula construction
    By Old Red One in forum Excel General
    Replies: 8
    Last Post: 02-10-2006, 09:10 AM
  4. formula construction w/ vba
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2005, 10:05 AM
  5. [SOLVED] formula construction II
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2005, 08:05 PM
  6. formula construction
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2005, 11:06 AM

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