+ Reply to Thread
Results 1 to 6 of 6

Query and sum based on multiple parameters

  1. #1
    Registered User
    Join Date
    05-17-2007
    Posts
    45

    Query and sum based on multiple parameters

    Hi all,

    I have a list of jobs - who's doing the work, an estimated duration and when it will be completed - and I'm trying to find an equation that will be able to query the list and take a sum for each person by week and day.

    For example, say I schedule John for a three hour job on Tuesday of week 44 with an estimated duration of three hours. I could write a sumif equation to look in an array for 'John' and return the duration, but that doesn't filter out the jobs I have him scheduled for on Wednesday of week 45. Index and Match functions haven't worked because I have mulitple jobs in a day and I'm after a sum. PivotTables haven't been all that helpful either...

    Any ideas will be greatly appriciated! Thank you

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Try using SUMPRODUCT, e.g.

    =SUMPRODUCT((A2:A100="John")+0,(B2:B100=45)+0,(C2:C100="Wednesday")+0,D2:D100)

    where column D contains the hours

  3. #3
    Registered User
    Join Date
    05-17-2007
    Posts
    45
    Maybe an easier way (if you know of a method) is using a PivotTable. Trouble is I pull these numbers from an outside source, the dates come back in a form 09/30/2007 11:37 AM, then if another job on the same day with a different time the PivotTable will seperate those just because of having different times. I can group all jobs that fall on a given day but with 400+ a week it'd get time consuming.

    This make sense? I hope so.. it's having the time associated with the day thats killing me. Thanks for your help

  4. #4
    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
    Daddylonglegs answer works

    By posting a sample of the data and your pivot we may be able to come up with an alternate answer for yoy



    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 !!!

  5. #5
    Registered User
    Join Date
    05-17-2007
    Posts
    45
    I think I got it - I added another column and used =text(B1,"dddd"); where before I was saying =(B1) and tried a custom format to show whatever day of the week it was. Doing it that way I'd have like 8 jobs labeled under 'Monday' for week 40 just because they started at different times - having that column as text seems to work though.

    Thanks for you time and help!

  6. #6
    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
    Did you try pivot built in function

    http://www.contextures.com/xlPivot07.html#Dates

    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