+ Reply to Thread
Results 1 to 9 of 9

Finding the Median with Conditions and Excluding Hidden Rows

  1. #1
    Registered User
    Join Date
    02-27-2023
    Location
    United States
    MS-Off Ver
    Microsoft 365, Excel, Version 2202
    Posts
    4

    Finding the Median with Conditions and Excluding Hidden Rows

    Hi, everyone. I need a function to find the median with conditions, and excluding hidden rows. For example, let's say we need to find the median of column B, but only for rows where: column A is either "apple" or "pear", column C is populated, and the row is not hidden/filtered.

    I haven't found a way to use =AGGREGATE with extra conditions, and I don't know of a way to use =MEDIAN while excluding hidden rows (though I do know how to use =MEDIAN with other conditions). I'm not very experienced with VBA and would prefer not to use it if I don't have to. Does anybody know how to do this? Let me know if any more information would be helpful.


    Edit: Here's a sample worksheet.
    test.xlsx
    Last edited by AlexaMT; 02-28-2023 at 01:15 PM.

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

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    A sample sheet would have helped... but try:

    =LET(A,A2:A20,B,B2:B20,C,G24,D, OFFSET(B,ROW(B)-MIN(ROW(B)),0,1,1),SUMPRODUCT(--(A=G24),SUBTOTAL(109,D))/SUMPRODUCT(--(A=G24),SUBTOTAL(103,D)))
    Attached Files Attached Files
    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

  3. #3
    Registered User
    Join Date
    02-27-2023
    Location
    United States
    MS-Off Ver
    Microsoft 365, Excel, Version 2202
    Posts
    4

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    Hi, Glen. Thanks for the formula, but after replacing the ranges it isn't working for me. I've edited my original post to include a sample sheet (sorry for not including it earlier).

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

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    I am now confused by your criteria.

    1. Please highlight those rows which you wish to have included in the calculation.

    2. Confirm that it is the MEDIAN (as opposed to the average or the mean) that you want.

  5. #5
    Registered User
    Join Date
    02-27-2023
    Location
    United States
    MS-Off Ver
    Microsoft 365, Excel, Version 2202
    Posts
    4

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    1. I've highlighted the rows in yellow.
    2. Yes, it's the MEDIAN (not the average or mean) that I'm looking for.

    Let me know if there's anything else I can clarify. Thanks!
    test.xlsx

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2408 and WPS V2024(12.1.0.18543)
    Posts
    3,834

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    The answer is required to be 9, but it should be actually 7

    Unless you change this MEDIUM FUNCTION to MAX

    You simply test the following formula =MEDIAN({9;9;3;2;7;7})

    Array formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by wk9128; 02-28-2023 at 08:36 PM.

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

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    I agree with wk9128. The answer IS 7, but it's not an array formula in your Excel version. Just Enter.

  8. #8
    Registered User
    Join Date
    02-27-2023
    Location
    United States
    MS-Off Ver
    Microsoft 365, Excel, Version 2202
    Posts
    4

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    Thank you both so much! This formula works. Sorry about all the confusion!

  9. #9
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2408 and WPS V2024(12.1.0.18543)
    Posts
    3,834

    Re: Finding the Median with Conditions and Excluding Hidden Rows

    @AlexaMT You're Welcome. Glad to help . Thank You for the feedback.

+ 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. Autofit rows excluding hidden
    By kk1352 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2021, 07:52 AM
  2. [SOLVED] ActiveCell.Offset excluding hidden rows
    By sleepa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2013, 09:37 AM
  3. [SOLVED] Sumif & Countif (excluding hidden rows)
    By JimExcel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-05-2013, 07:06 AM
  4. [SOLVED] excluding Hidden Rows from my =SUMIF formula PLEASE HELP!
    By LeatherChair in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-16-2012, 10:23 AM
  5. SUMIF Excluding Hidden Rows
    By bleat0r in forum Excel General
    Replies: 3
    Last Post: 09-16-2010, 02:36 AM
  6. How can I do number series excluding the hidden rows?
    By Maryam in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-16-2008, 01:57 AM
  7. SUMIF Excluding hidden rows
    By TREMA in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-27-2008, 08:54 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