+ Reply to Thread
Results 1 to 9 of 9

SUMPRODUCT using 2 column headings as criteria

  1. #1
    Registered User
    Join Date
    10-09-2014
    Location
    canada
    MS-Off Ver
    10
    Posts
    6

    SUMPRODUCT using 2 column headings as criteria

    I have a data set with 2 column headings.

    I can sum all the data where row 2 = 0
    =SUMPRODUCT(('Weekly Hrs'!L4:S4=0)*'Weekly Hrs'!L8:S19)
    and I can sum all the data where row 1 = Phase!A5
    =SUMPRODUCT(('Weekly Hrs'!L5:S5=Phase!A5)*'Weekly Hrs'!L8:S19)

    However, when I try and do both: ie: sum all data where row 2 = 0 and row 1 = Phase!A5
    =SUMPRODUCT(('Weekly Hrs'!L5:S5=Phase!A5)*('Weekly Hrs'!L4:S4=0),'Weekly Hrs'!L8:S19)
    I get a #VALUE error: a value used in the formula is of the wrong datatype.

    Any suggestions on where I'm going wrong please?

    Design Test Test
    0 1 1 1
    4 4 3 3
    1 1 2 1
    0 2 1 3

  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 using 2 column headings as criteria

    You changed the syntax from

    =SUMPRODUCT(('Weekly Hrs'!L4:S4=0)*'Weekly Hrs'!L8:S19)
    to
    =SUMPRODUCT(('Weekly Hrs'!L5:S5=Phase!A5)*('Weekly Hrs'!L4:S4=0),'Weekly Hrs'!L8:S19)

    Try
    =SUMPRODUCT(('Weekly Hrs'!L5:S5=Phase!A5)*('Weekly Hrs'!L4:S4=0)*'Weekly Hrs'!L8:S19)

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: SUMPRODUCT using 2 column headings as criteria

    Try

    =SUMPRODUCT(('Weekly Hrs'!L5:S5=Phase!A5)*('Weekly Hrs'!L4:S4=0)*('Weekly Hrs'!L8:S19))
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    10-09-2014
    Location
    canada
    MS-Off Ver
    10
    Posts
    6

    Re: SUMPRODUCT using 2 column headings as criteria

    Thank you, Jonmo1 and ChemistB that's perfect!

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

    Re: SUMPRODUCT using 2 column headings as criteria

    You're welcome.

  6. #6
    Registered User
    Join Date
    10-09-2014
    Location
    canada
    MS-Off Ver
    10
    Posts
    6

    Re: SUMPRODUCT using 2 column headings as criteria

    Actually, I now need to take this one step further:
    I have a Rate column that I need to apply to the values before I sum them.
    So if my rate column was:
    4
    5
    6

    I would have (4*4)+(1*5)+(6*0) as the result for Design and 0 criteria.
    So for all Design cells that have 0 I need to multiply the value in the cell by the rate before summing. Is this even possible?
    I've attached a spreadsheet example of the data which would hopefully clarify if I haven't explained fully.

    example.xlsx

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

    Re: SUMPRODUCT using 2 column headings as criteria

    You can just multiply in the Rate column

    =SUMPRODUCT(($B$5:$E$5=A1)*($B$4:$E$4=0)*$B$6:$E$8*$A$6:$A$8)

  8. #8
    Registered User
    Join Date
    10-09-2014
    Location
    canada
    MS-Off Ver
    10
    Posts
    6

    Re: SUMPRODUCT using 2 column headings as criteria

    That's fantastic, you've saved me hours of poking at this.
    Thank you very much!

  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 using 2 column headings as criteria

    You're welcome

+ 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. SUMPRODUCT Criteria - Do Not Include Value From Separate Column
    By freybe06 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-11-2014, 10:26 AM
  2. Replies: 6
    Last Post: 08-04-2013, 11:53 AM
  3. Replies: 2
    Last Post: 01-27-2012, 01:32 PM
  4. [SOLVED] Can I invert a table so row headings are now column headings etc
    By Sharon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-10-2005, 04:06 PM
  5. [SOLVED] Sumproduct - multiple criteria in Column A
    By briank in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-06-2005, 03:06 PM

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