+ Reply to Thread
Results 1 to 11 of 11

Find the max column value given certain restrictions or filters on the data set

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Find the max column value given certain restrictions or filters on the data set

    Please find the enclosed file as this would help explain what i am trying to do.

    I want to find the maximum value for a given LotID when the status is not equal to "closed"..........any thoughts?
    Attached Files Attached Files

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Find the max column value given certain restrictions or filters on the data set

    Give this array formula a shot

    =MAX(IF(--(A$2:A$114=TEXT(F2,0))*--(B$2:B$114<>"Closed"),C$2:C$114,0))

    confirmed with Ctrl+Shift+Enter
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Find the max column value given certain restrictions or filters on the data set

    In G2

    =MAX(IF($A$2:$A$114=F2;$B$2:$B$114="Closed";$C$2:$C$114))

    Array formula(C+Sh+E))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Find the max column value given certain restrictions or filters on the data set

    I tried both.......

    Fotis1991: i could not get yours to work....every time i pressed cntr+shift+enter.....would highlight the F2 in the cell.

    DGagnon : Looks like yours worked.......just wish i understood the formula.

  5. #5
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Find the max column value given certain restrictions or filters on the data set

    sure i can break it down

    because it is an arry formula, it will exicute the IF statements individualy, so it will look at each row, it will do this

    If A2=F2 and (signified by the *) B2<>Closed then return C2 else return 0
    If A3=F3 and (signified by the *) B3<>Closed then return C3 else return 0
    If A4=F4 and (signified by the *) B4<>Closed then return C4 else return 0
    .
    .
    .
    If A114=F114 and (signified by the *) B114<>Closed then return C114 else return 0

    it returns all of those values to the MAX formula, which finds the highest returned value.


    hope this helps.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Find the max column value given certain restrictions or filters on the data set

    Hi

    First i had to told you not in g2, but in h2.

    Secondly, DGagnon, is more cleaver than me and noticed the point! Point is the Text function.

    Because if you put, =F2=A2, you will get a False! Looks that are not the same values.

    My poor English does not allow me to explain better....

    Well done, DGagnon

  7. #7
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Find the max column value given certain restrictions or filters on the data set

    Thank you Fotis, Much appreciated.

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Find the max column value given certain restrictions or filters on the data set

    thanks for the info.

  9. #9
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Find the max column value given certain restrictions or filters on the data set

    quick question.......

    what are the "--" in the formula's what do they do?

  10. #10
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Find the max column value given certain restrictions or filters on the data set

    it basicaly converts the TRUE or FALSE that is retunred by the formula into a 1 or 0

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Find the max column value given certain restrictions or filters on the data set

    .....but in this case the * which multiplies the two conditions does that for you so you can safely removed the two instances of -- and the formula should still work. My preference would be this version

    =MAX(IF(A$2:A$200=F2&"",IF(B$2:B$200<>"Closed",C$2:C$200)))
    Audere est facere

+ 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