+ Reply to Thread
Results 1 to 4 of 4

Finding the minimum in a range while checking for conditions to exclude cells in the range

  1. #1
    Registered User
    Join Date
    03-31-2012
    Location
    Lumbabo
    MS-Off Ver
    Excel 2010
    Posts
    4

    Finding the minimum in a range while checking for conditions to exclude cells in the range

    I am having the following problem which I would like to solve using only excel functions without resorting to programming in vba or macros or manual commands.

    I have a list of numbers in an array and I am looking for the minimal number in that array that satisfies some conditions, the conditions are such that they might exclude some cells in the array.
    The ideal solution would have been a command like MINIF(range,condition) but such a function does not exist for MIN (it exists for counting COUNTIF)

    How do I achieve the same result using other EXCEL functions?

    Keep in mind that the array length and the conditions change dynamically during the run.

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Finding the minimum in a range while checking for conditions to exclude cells in the r

    You can do it using an array formula =MIN(IF(condition1*condition2)) and finish with Ctrl-Shift-Enter
    Last edited by Søren Larsen; 03-31-2012 at 12:32 PM. Reason: DDL is right
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

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

    Re: Finding the minimum in a range while checking for conditions to exclude cells in the r

    You wouldn't normally use AND as that can't return an array

    You could get the minimum value in column A when column B is "x" and column C is > 100 like this with multiple IFs

    =MIN(IF(B2:B100="x",IF(C2:C100>100,A2:A100)))

    ......or use * to replicate AND like

    =MIN(IF((B2:B100="x")*(C2:C100>100),A2:A100))

    both formulas need to confirmed with CTRL+SHIFT+ENTER

    the first one above is probably marginally more efficient. You can add extra conditions as required
    Audere est facere

  4. #4
    Registered User
    Join Date
    03-31-2012
    Location
    Lumbabo
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Finding the minimum in a range while checking for conditions to exclude cells in the r

    Quote Originally Posted by daddylonglegs View Post
    You wouldn't normally use AND as that can't return an array

    You could get the minimum value in column A when column B is "x" and column C is > 100 like this with multiple IFs

    =MIN(IF(B2:B100="x",IF(C2:C100>100,A2:A100)))

    ......or use * to replicate AND like

    =MIN(IF((B2:B100="x")*(C2:C100>100),A2:A100))

    both formulas need to confirmed with CTRL+SHIFT+ENTER

    the first one above is probably marginally more efficient. You can add extra conditions as required


    Many thanks, I should have provided more details:

    I am having the following problem which I would like to solve using only excel functions without resorting to programming in vba or macros or manual commands.

    I have a list of numbers in an array (a1:a700) and I am looking for the minimal number in that array that satisfies some conditions, the conditions are such that they might exclude some cells in the array. Cells in the array are excluded if their values are higher than a value stored in cell D1.
    The ideal solution would have been a function like MINIF(range,condition) but such a function does not exist for MIN (it exists for counting COUNTIF, SUMIF, ...)

    How do I achieve the same result using other EXCEL functions?

    Keep in mind that the array length and the conditions change dynamically during the run.

  5. #5
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Finding the minimum in a range while checking for conditions to exclude cells in the r

    I'm not sure I understand your problem, since finding the smallest value while exluding values above a given threshold, will return the same value as just finding the minimum of the array. Could you describe your problem a little more?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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