+ Reply to Thread
Results 1 to 9 of 9

MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

  1. #1
    Forum Contributor
    Join Date
    07-31-2018
    Location
    London, England
    MS-Off Ver
    MS Office 365
    Posts
    104

    MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    Hi all,

    I have been having some trouble with a database I am working on lately.

    I would like to calculate the MIN/MAX/MEDIAN/AVERAGE/MODE for a range of ages, however, I only want the age to be considered if some sort of criteria is met originally.

    I have attached the workbook, and essentially I would like a formula to apply to this sort of criteria

    'Group _ Details'!$B$6:$B$31, {"Achiever", "Units", "Fail", "*Learner*"}
    And then calculate the minimum, maximum, median, mean and modal ages for only the entries that meet the above criteria. What formula should I use for that?

    If you would like additional background info, here is the link to my previous thread: https://www.excelforum.com/excel-for...ml#post4950022

    Thanks in advance.
    Last edited by doubleuson; 08-07-2018 at 11:05 AM. Reason: Changed Incorrect Attached File

  2. #2
    Forum Contributor
    Join Date
    07-31-2018
    Location
    London, England
    MS-Off Ver
    MS Office 365
    Posts
    104

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    /BUMP still need assistance with this issue

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

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    Your file opened with the cursor in J28, where you have this "formula":

    |IF(D28=0,0,(SUM(COUNTIFS('Group _ Details'!$X$6:$X$31, {"Employment", "Apprenticeship", "Further Learning", "Own Business", "Other"}, 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Apprenticeship", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Further Learning", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Own Business", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Other", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian"))
    /SUM(COUNTIFS('Group _ Details'!$X$6:$X$31, {"Employment","Apprenticeship","Further Learning","Own Business","Other","Jobseeking","Unknown"}, 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Apprenticeship", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Further Learning", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Own Business", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Other", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Jobseeking", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")
    +COUNTIFS('Group _ Details'!$X$6:$X$31, "=Unknown", 'Group _ Details'!$R$6:$R$31, "=Mixed/Asian")))

    I've told you before that you do not need the = sign in the criteria, so "=Mixed/Asian" can become "Mixed/Asian", and you can remove those other = signs.

    It is not very clear what you are trying to do here, as you've got a big COUNTIFS expression divided by the same COUNTIFS expression.

    The criteria for the second part of the COUNTIFS all refer to:

    'Group _ Details'!$R$6:$R$31, "=Mixed/Asian"

    but you have "Mixed/Asian" in cell C28, so you could just refer to that cell instead of the text explicitly, and that will help you in copying the formula down.

    I don't know what values you can have within the range 'Group _ Details'!$X$6:$X$31, but it strikes me that maybe you want to take any value, in which case that part of the formula is redundant.

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    07-31-2018
    Location
    London, England
    MS-Off Ver
    MS Office 365
    Posts
    104

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    Hi Pete, since this was posted I rehashed the long formulae into shorter ones.

    I have updated the attached file as a result.

    How would I go about using the MIN/MAX formulae in this case?

  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,728

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    The functions MINIFS and MAXIFS were introduced in XL version 2016, so you don't have access to those if your profile is correct.

    However, you can still get the equivalent by using an array formula.

    Where is the formula going (i.e. which cell), what are the criteria to be applied, and which data do you want to get the MIN/MAX from ?

    Pete

  6. #6
    Forum Contributor
    Join Date
    07-31-2018
    Location
    London, England
    MS-Off Ver
    MS Office 365
    Posts
    104

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    Unfortunately, I do not have those formulae on my version. The MIN will be in 'Group _ Data Report'!D66, MEDIAN in 'Group _ Data Report'!D67, MAX in 'Group _ Data Report'!D68, AVERAGE in 'Group _ Data Report'!D69 and MODE in 'Group _ Data Report'!D70.

    Their target is 'Group _ Details'!$G$6:$G$31 and the criteria a data input should only be considered if the respective 'Group _ Details'!$B$6:$B$31 is listed as {"Achiever", "Units", "Nonachiever", "*Learner*"}

  7. #7
    Forum Contributor
    Join Date
    07-31-2018
    Location
    London, England
    MS-Off Ver
    MS Office 365
    Posts
    104

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    /BUMP this thread as I'd like to resolve this today

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    An array formula for the MIN

    =MIN(IF(ISNUMBER(SEARCH({"Achiever","Units","Nonachiever","*Learner*"},DATable1[STAGE])),DATable1[AGE]))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    The same method applies to all of the functions you listed, just change MIN to MEDIAN, MAX etc. Note that MODE will return #N/A! if you don't have at least 2 people of the same age that match the criteria.

  9. #9
    Forum Contributor
    Join Date
    07-31-2018
    Location
    London, England
    MS-Off Ver
    MS Office 365
    Posts
    104

    Re: MIN/MEDIAN/MAX/MODE/AVERAGE Functions with Criteria

    Quote Originally Posted by jason.b75 View Post
    An array formula for the MIN

    =MIN(IF(ISNUMBER(SEARCH({"Achiever","Units","Nonachiever","*Learner*"},DATable1[STAGE])),DATable1[AGE]))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    The same method applies to all of the functions you listed, just change MIN to MEDIAN, MAX etc. Note that MODE will return #N/A! if you don't have at least 2 people of the same age that match the criteria.
    Awesome, exactly what I was looking for.

    /SOLVED Thanks

+ 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. [SOLVED] Median and Mode with Criteria
    By rpjwhite in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-15-2016, 11:23 AM
  2. Average, Median, multiple criteria, unique values, dynamic worksheet
    By branchoff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2016, 12:04 PM
  3. Replies: 1
    Last Post: 02-11-2016, 06:02 PM
  4. [SOLVED] Mode If and Median If help
    By bobthebofifn in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-19-2014, 01:44 PM
  5. [SOLVED] Calculate Mode, Median and Average based on data in 3 columns
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2014, 05:56 PM
  6. [SOLVED] defining a range subset based on a primary range for use in Median and Mode functions
    By Araise in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-06-2013, 06:39 PM
  7. Median and mode
    By maestrodos in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2012, 10:40 PM

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