+ Reply to Thread
Results 1 to 9 of 9

multiple conditions with Function Sumif

  1. #1
    Registered User
    Join Date
    01-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    18

    multiple conditions with Function Sumif

    How can I apply multiple conditions with Function Sumif? Have attached a raw file.

    Problem.xlsx

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: multiple conditions with Function Sumif

    Look to use the Sumifs function
    http://www.techrepublic.com/blog/mso...-in-excel/6538
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: multiple conditions with Function Sumif

    Try

    =SUMIF($A$2:$A$8,"Activity 2", INDEX($B$2:$F$8,,MATCH(DATEVALUE("1/4/2013"),$B$1:$F$1,0)))
    HTH
    Regards, Jeff

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: multiple conditions with Function Sumif

    hi Punter, welcome to the forum. you dont need SUMIF if all you need is a single value. try:
    =INDEX($B$2:$F$8,MATCH("Activity 2",$A$2:$A$8,0),MATCH(--("4jan13"),$B$1:$F$1,0))

    or if there is a chance "Activity 2" appears more than once, then:
    =SUMIF(A2:A8,"Activity 2",INDEX(B2:F8,,MATCH(--("4jan13"),B1:F1,0)))

    "Activity 2" & --("4jan13") can be referred to a cell reference where such values exist

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  5. #5
    Registered User
    Join Date
    01-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: multiple conditions with Function Sumif

    Quote Originally Posted by benishiryo View Post
    hi Punter, welcome to the forum. you dont need SUMIF if all you need is a single value. try:
    =INDEX($B$2:$F$8,MATCH("Activity 2",$A$2:$A$8,0),MATCH(--("4jan13"),$B$1:$F$1,0))

    or if there is a chance "Activity 2" appears more than once, then:
    =SUMIF(A2:A8,"Activity 2",INDEX(B2:F8,,MATCH(--("4jan13"),B1:F1,0)))

    "Activity 2" & --("4jan13") can be referred to a cell reference where such values exist
    Thank You Very Much! I hardly use the deadly combo of Index & Match, if you can please help me understand this formula.

  6. #6
    Registered User
    Join Date
    01-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: multiple conditions with Function Sumif

    Quote Originally Posted by jeffreybrown View Post
    Try

    =SUMIF($A$2:$A$8,"Activity 2", INDEX($B$2:$F$8,,MATCH(DATEVALUE("1/4/2013"),$B$1:$F$1,0)))
    Thank You Jeff!

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: multiple conditions with Function Sumif

    You're welcome…glad it worked out for you and thanks for the feedback...

  8. #8
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: multiple conditions with Function Sumif

    ahhh luckily for Jeff's reply. i almost forgot to respond

    there are 4 arguments available for use in INDEX, but i'm just using 3 parts of it; array, row_num, column_num.
    array
    $B$2:$F$8
    this is the range where my desired results are

    row_num
    MATCH("Activity 2",$A$2:$A$8,0)
    this is the row number my result is in, using the array range. if you manually count, "Activity 2" is the 2nd row of B2:F8. but using MATCH will help you not use manual calculation.

    column_num
    MATCH(--("4jan13"),$B$1:$F$1,0)
    this is the column number my result is in, using the array range. if you manually count, "4-Jan-13" is the 4th column of B2:F8. but again, using MATCH will help you not use manual calculation.

    so by manually keying in the row & column number, the INDEX should look like this:
    =INDEX($B$2:$F$8,2,4)
    meaning in B2:F8, i want the 2nd row & 4th column.

    the MATCH formula has up to 3 arguments; lookup_value, lookup_array, match_type
    lookup_value
    the value we want to search for. for INDEX's row_num, we want to look for "Activity 2". and for INDEX's Column_num, we want to look for "4Jan13"

    lookup_array
    the range where we want to search in, using the lookup_value.

    match_type
    0 is for exact match. and that's what we want. only when the values are exactly the same, return the row or column number.

    --("4jan13") by the way, is to convert the text of 4jan13 to a date Excel recognises. Excel recognises dates as numbers. change the format of B1:F1 as General & you'll see what i mean. hope that helps. if you're satisfied with the answer, please mark it as "Solved". my signature in the thread will guide you how to do that. thanks

  9. #9
    Registered User
    Join Date
    01-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    18

    Smile Re: multiple conditions with Function Sumif

    @benishiryo,

    I am very grateful to you. Thanks once gain for spending your precious time on helping me understand the Logic....You're a Champ

    Moderators Note:
    • As per Forum Rule #12, please don't quote whole posts unless necessary-- it's just clutter...Thanks.
    Last edited by jeffreybrown; 01-26-2013 at 09:18 AM.

+ 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