+ Reply to Thread
Results 1 to 9 of 9

Find MIN & MAX values based on an IF condition for an array.

  1. #1
    Registered User
    Join Date
    03-24-2016
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    32

    Find MIN & MAX values based on an IF condition for an array.

    Hi guys,

    I have 3 projects with various number of tasks involved in them with start and end date for each task in sheet 1. I need help to calculate Start and end date automatically for each project in sheet 2 based on data from sheet 1.

    I have attached an example file. I couldn't figure out how to use IF conditions using MIN & MAX functions.


    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Find MIN & MAX values based on an IF condition for an array.

    Use this array* formula in C3:

    =MIN(IF(Sheet1!$B$3:$B$34=$B3,Sheet1!D$3:D$34))

    and this array* formula in D3:

    =MAX(IF(Sheet1!$B$3:$B$34=$B3,Sheet1!E$3:E$34))

    then copy down.

    *An array formula needs to be committed using the key combination of Ctrl-Shift-Enter (CSE) rather than the usual < Enter >

    Hope this helps.

    Pete

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find MIN & MAX values based on an IF condition for an array.

    use:

    =MIN(IF(Sheet1!$B$3:$B$34=Sheet2!$B3,Sheet1!D$3:D$34))

    and

    =MAX(IF(Sheet1!$B$3:$B$34=Sheet2!$B3,Sheet1!E$3:E$34))

    entered as an array.

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    03-24-2016
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    32

    Re: Find MIN & MAX values based on an IF condition for an array.

    Thanks Guys.

    Formula kinda worked.

    Sorry, I forgot to mention that in my original sheet I have arrays with 1000+ values incl blanks. Right now, as there are blanks, MIN value is becoming "Zero". So formula shall exclude blanks in the array.

    MAX function worked perfectly.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Find MIN & MAX values based on an IF condition for an array.

    You can use this array* formula in C3 instead:

    =MIN(IF((Sheet1!$B$3:$B$34=B3)*(Sheet1!$D$3:$D$34<>""),Sheet1!$D$3:$D$34))

    to ignore blank entries. Adjust the cell references to $34 (3 times) to suit your actual data.

    *Remember to use CSE to commit the formula, as previously advised, and then copy down.

    Hope this helps.

    Pete

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Find MIN & MAX values based on an IF condition for an array.

    For users of Excel 2010 and higher: You can also use these two alternative formulas:
    For MIN
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For MAX
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Both formulas are entered as regular formulas and the also ignore blank cells.
    Last edited by AlKey; 01-24-2017 at 09:29 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find MIN & MAX values based on an IF condition for an array.

    Given your data layout this also works. In C3 filled down and across to D5.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  8. #8
    Registered User
    Join Date
    03-24-2016
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    32

    Re: Find MIN & MAX values based on an IF condition for an array.

    Hi Pete,

    Your formula worked.

    I haven't tried other two. Will give a try.

    Thanks everyone.

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Find MIN & MAX values based on an IF condition for an array.

    You're welcome - glad to have helped.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post and mark this thread as SOLVED.

    Also, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 11-07-2016, 07:49 AM
  2. Replies: 1
    Last Post: 01-23-2015, 12:36 PM
  3. Required Unique values based on if condition (array)
    By Punnam in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-30-2014, 01:09 AM
  4. [SOLVED] Array Formula to find an offset value based on a certain condition.
    By montehoskey in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-14-2014, 10:54 PM
  5. [SOLVED] Return an array based on condition
    By ecelaras in forum Excel General
    Replies: 10
    Last Post: 11-23-2012, 11:01 AM
  6. Find a value in an array and return multiple values in an adjacent array
    By tonbra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2012, 08:35 PM
  7. Store cell values in an array and return values on specific condition
    By gmalpani in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 11-27-2011, 06:43 AM

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