+ Reply to Thread
Results 1 to 13 of 13

SUMIF with Multiple Conditions

  1. #1
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    SUMIF with Multiple Conditions

    I'm trying to get a sum only if 2 conditions are met.

    Column A has dates (ex. 01/02/2007) in a random order. Column B has a location in a text format (ex. London). Column C has a series of values formatted as [h]:mm.

    What I'm trying to do is get a sum of the values in column C where the corresponding values in columns A and B = the date and loction I specify. I've tried...

    =SUM(IF(('Jan ''07'!A$2:A$750="1/2/2007")*('Jan ''07' E$2:E$750="London"),'Jan ''07'!J$2:J$750))

    but it's returning zero values regardless of the criteria being met or not. Any suggestions ?

  2. #2
    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

    =SUMPRODUCT(--(TEXT($A$2:$A$10,"dd/mm/yy")="01/02/07")*(--($B$2:$B$10="London")*(TEXT($C$2:$C$10,"hh:mm"))))

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

  3. #3
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    No Luck

    I've tried modifying the formula you provided after changing the A, B, C to the actual ranges and am getting the same result. Do you see any syntax errors that may be causing the problem ?

    =SUMPRODUCT(--(TEXT('Jan ''07'!$A$2:$A$750,"dd/mm/yy")="01/01/07")*(--('Jan ''07'!$E$2:$E$750="London")*(TEXT('Jan ''07'!$J$2:$J$750,"hh:mm"))))

  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
    Formula cell Needs to be formatted as [H]:MM

    VBA Noob

  5. #5
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    Cell Format

    Yep, it was already formatted that way.

  6. #6
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    Dates ?

    The column with the dates in it is formatted as such, not as text. Could that have an impact ?

  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
    Post an example and I'll have a look

    VBA Noob

  8. #8
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    ???

    Please forgive the total newb question... but how do I send you an example? I've tried to attach, but I'm only getting an option for graphics and .txt files.

  9. #9
    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

  10. #10
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    Link

    http://www.savefile.com/projects/1063372

    There's the file... thanks a million times for your help. This is driving me bonkers.

  11. #11
    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

    =SUMPRODUCT(--('Jan ''07'!$A$2:$A$750=DATEVALUE("01/01/2007"))*(--('Jan ''07'!$E$2:$E$750="London")*('Jan ''07'!$J$2:$J$750)))

    VBA Noob

  12. #12
    Registered User
    Join Date
    02-11-2004
    Posts
    56

    Woohoo!

    It works ! You're a god !

  13. #13
    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
    Thanks for the feedback.

    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