+ Reply to Thread
Results 1 to 8 of 8

How to use MAX function with multiple condition

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-17-2009
    Location
    Kuwait
    MS-Off Ver
    Microsoft Excel for Microsoft 365
    Posts
    114

    Question How to use MAX function with multiple condition

    Hi;
    I need your help to extract the maximum record based on DATE & CONTACT & ACTION. The attached file showing the correct result but it done "manual ", if there is some records are having the same DATE then the maximum record will be whoever having the flag of "CONP" in column ACTION.

    I am using EXCEL 2007

    BR
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: How to use MAX function with multiple condition

    This will give you TRUE or FALSE regarding to contact but doesn't consider CONP criteria:

    =MAX(IF($A$2:$A$42=A2,$C$2:$C$42))=C2

    comfirmed with ctrl+shift+enter
    Never use Merged Cells in Excel

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: How to use MAX function with multiple condition

    This should do your quest:

    =MAX(IF($A$2:$A$42=A2,$C$2:$C$42-CODE(LEFT($B$2:$B$42,1))))=C2-CODE(LEFT($B2,1))

    comfirmed with ctrl+shift+enter

    Edit: note that criteria must be sorted alphabeticaly: CONP > DINP > INST > WARN
    Attached Files Attached Files
    Last edited by zbor; 08-05-2010 at 06:05 AM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to use MAX function with multiple condition

    Using your original sample file wherein we assume sorting data is not permitted (else we would sort by date etc) then:

    D2:
    =REPT("P",(MAX(IF($A$2:$A$42=$A2,$C$2:$C$42))=$C2)*OR($B2="CONP",ISNA(MATCH($A2&"@CONP@"&$C2,$A$2:$A$42&"@"&$B$2:$B$42&"@"&$C$2:$C$42,0))))
    confirmed with CTRL + SHIFT + ENTER (enter alone will not suffice)
    copied down
    it's not clear what should happen in scenarios where multiple MAX dates are located for a given contact but none of those dates has COMP action - ie which is then to be selected ?

    the above is merely an alternative... a little long winded I grant you !
    Last edited by DonkeyOte; 08-05-2010 at 06:18 AM.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: How to use MAX function with multiple condition

    now I see that CODE might enter sometimes error between dates so dividing with some number would be better:

    =IF(MAX(IF($A$2:$A$42=A2;$C$2:$C$42-CODE(LEFT($B$2:$B$42;1))/1000))=C2-CODE(LEFT($B2;1))/1000;"P";"")
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    11-17-2009
    Location
    Kuwait
    MS-Off Ver
    Microsoft Excel for Microsoft 365
    Posts
    114

    Re: How to use MAX function with multiple condition

    Thanks for all your feedback, it really helpful and useful.

  7. #7
    Registered User
    Join Date
    10-25-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    3

    How to find max number in multiple inputs?

    Hi there;
    can anyone help me to find the max of following series..Please note that I have more names and numbers in my hand therefore I wont be able to use individual search, it should be generic.

    John 27.89
    John 28.26
    John 28.31
    John 26.3
    John 24.69
    John 22.79
    John 30.01
    Cate 11.93
    Cate 11.92
    Cate 11.28
    Cate 10.63
    Cate 9.74
    Cate 8.45
    Cate 10.46
    Joe 13.39
    Joe 12.47
    Joe 13.09
    Joe 14.55
    Joe 13.19
    Joe 14.24
    Joe 14.02


    results must be only in following format for above list.


    John 30.01
    Cate 11.93
    Joe 14.55


    Many thanks in advance.

  8. #8
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to use MAX function with multiple condition

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ 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