+ Reply to Thread
Results 1 to 8 of 8

How to sum hours based on criteria in to "tables"

  1. #1
    Registered User
    Join Date
    05-28-2016
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    5

    How to sum hours based on criteria in to "tables"

    Having to "tables" i Excel

    Please Login or Register  to view this content.
    A2:C6 shows a list of projects. Each project belongs to one og more categories
    E2:F4 shows the time spent on each project

    I'm looking for a way to sum the time spent in each category. The answer is obvious (40h and 50h), but I can't figure out how to construct a working formula, that will provide the answer

    Please Login or Register  to view this content.
    Any ideas ?
    Last edited by torsten911; 05-28-2016 at 08:33 AM.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: How to sum hours based on criteria in to "tables"

    How many hours for P4 ?

  3. #3
    Registered User
    Join Date
    05-28-2016
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    5

    Re: How to sum hours based on criteria in to "tables"

    In this case: None :-) The first liste shows the relation between Projects and Categories. The second list shows hours spent on each project. In some periodes no one has worked on a specific project.

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: How to sum hours based on criteria in to "tables"

    Try this
    I2:
    =SUMPRODUCT(($E$2:$E$4=$A$3:$A$5)*(B3:B5="x")*$F$2:$F$4)
    I3:
    =SUMPRODUCT(($E$2:$E$4=$A$3:$A$5)*(C3:C5="x")*$F$2:$F$4)

  5. #5
    Registered User
    Join Date
    05-28-2016
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    5

    Re: How to sum hours based on criteria in to "tables"

    Quote Originally Posted by Phuocam View Post
    Try this
    I2:
    =SUMPRODUCT(($E$2:$E$4=$A$3:$A$5)*(B3:B5="x")*$F$2:$F$4)
    I3:
    =SUMPRODUCT(($E$2:$E$4=$A$3:$A$5)*(C3:C5="x")*$F$2:$F$4)
    Thank you very much for your solution. It Works. But i in your solution the (B3:B5="x") is hardcoded. The relation between the categories is hardcoded. I can't be sure, that category "C1" will be listed in column B. It might be in column B or C or D. Is it possible to build a more generic version of the formula ? :-)

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to sum hours based on criteria in to "tables"

    Is this generic enough?

    =SUMPRODUCT(COUNTIFS($A$3:$A$6,$E$2:$E$4,INDEX($B$3:$C$6,0,MATCH($H2,$B$2:$C$2,0)),"x"),$F$2:$F$4)

  7. #7
    Registered User
    Join Date
    05-28-2016
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    5

    Re: How to sum hours based on criteria in to "tables"

    Quote Originally Posted by jason.b75 View Post
    Is this generic enough?

    =SUMPRODUCT(COUNTIFS($A$3:$A$6,$E$2:$E$4,INDEX($B$3:$C$6,0,MATCH($H2,$B$2:$C$2,0)),"x"),$F$2:$F$4)
    Boy, you're skilled :-) I'll try it out right away :-)

  8. #8
    Registered User
    Join Date
    05-28-2016
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    5

    Re: How to sum hours based on criteria in to "tables"

    Quote Originally Posted by jason.b75 View Post
    Is this generic enough?

    =SUMPRODUCT(COUNTIFS($A$3:$A$6,$E$2:$E$4,INDEX($B$3:$C$6,0,MATCH($H2,$B$2:$C$2,0)),"x"),$F$2:$F$4)
    Had to translate it to Danish. The good news: It Works perfectly. Thank you very much! :-) Have a nice weekend.

+ 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] Need Help with formula to calculate "hours scheduled" based on employee's number
    By Dnakr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2014, 02:56 PM
  2. [SOLVED] Auto-populate "Yes" "No" based on multiple criteria.
    By jtmoore in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-18-2014, 09:12 AM
  3. Replies: 1
    Last Post: 06-06-2013, 06:28 PM
  4. [SOLVED] Find multiple "text" criteria and return as ""Yes" in Matrix
    By bertrand82 in forum Excel General
    Replies: 11
    Last Post: 04-30-2012, 09:20 AM
  5. Replies: 3
    Last Post: 05-08-2010, 08:47 AM
  6. Replies: 0
    Last Post: 07-09-2009, 04:07 PM
  7. Replies: 3
    Last Post: 04-24-2006, 01:35 PM

Tags for this Thread

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