+ Reply to Thread
Results 1 to 6 of 6

Need help with dynamic named ranges and medians based on specific criteria

  1. #1
    Registered User
    Join Date
    11-12-2020
    Location
    Florida, United States
    MS-Off Ver
    2010
    Posts
    2

    Need help with dynamic named ranges and medians based on specific criteria

    Good afternoon everyone,
    I've been lurking around for a while and have learned a good bit about excel and how to muddle through it, but I have run into a problem I cannot seem to solve.

    I have attached a sample workbook with data and a brief description of what I need.

    I am attempting to set up a spreadsheet where I can count matches in column B and count non matches in column B. If column B matches the criteria I need to obtain the median of column C, the median of column D and the median of column E as well as the median of Column D/Column C. I need it to be set up as dynamic named ranges as the number of rows will change frequently. I have removed the other columns from the data to make it easier to read and to remove any sensitive data. If it matters, there are typically 38 columns, but the ones included are the ones pertinent to the questions at hand. The number of rows will change frequently.

    I have tried setting up the dynamic named ranges, but ran into particular problems with column B due to there being blank cells I think. So I thought I would reach out here to see if anyone has a simpler and more elegant solution to manually manipulating the data everytime I run this report.

    Also, if at all possible, I need this to be functional in excel 97-2003. I have the current version, but the reports will be opened in an older version when I am done working on them.

    Thank you tremendously
    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
    25,437

    Re: Need help with dynamic named ranges and medians based on specific criteria

    You can use the following formulae in the cells stated:

    J5: =COUNTIF(B2:B154,"SLD")

    J6: =COUNTIF(B2:B154,"<>SLD")

    J7: =MEDIAN(IF(B2:B154="SLD",C2:C154)) ... NB - Array formula, see below

    J8: =MEDIAN(IF(B2:B154="SLD",D2:D154)) ... NB - Array formula, see below

    J9: =MEDIAN(IF(B2:B154="SLD",E2:E154)) ... NB - Array formula, see below

    J10: =MEDIAN(IF(B2:B154="SLD",D2:D154/C2:C154)) ... NB - Array formula, see below

    Note that an array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual Enter.

    It is a 10-second job to apply named ranges to columns B to E, using the headings that are on row 1, so I suggest you do that instead of making the ranges dynamic.

    Hope this helps.

    Pete

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

    Re: Need help with dynamic named ranges and medians based on specific criteria

    I didn't realise that you already had your dynamic named ranges already set up using OFFSET - I prefer to use INDEX, which is not volatile. Here are the formulae using your named ranges:

    J5: =COUNTIF(Status,"SLD")

    J6: =COUNTIF(Status,"<>SLD")

    J7: =MEDIAN(IF(Status="SLD",LP))

    J8: =MEDIAN(IF(Status="SLD",SP))

    J9: =MEDIAN(IF(Status="SLD",Days))

    J10: =MEDIAN(IF(Status="SLD",SP/LP))

    Note that the last 4 formulae are all array formulae, so you need to use CSE to commit them, as previously advised.

    Hope this helps.

    Pete

    EDIT: Note also that these will be compatible with earlier versions of Excel.

    Pete

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,613

    Re: Need help with dynamic named ranges and medians based on specific criteria

    Here's your workbook with Dynamic Named Ranges
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    11-12-2020
    Location
    Florida, United States
    MS-Off Ver
    2010
    Posts
    2

    Re: Need help with dynamic named ranges and medians based on specific criteria

    Thanks for the assistance folks. Still having some trouble, but I'm working through it and hope this will help me to shave some time off my workload each day.

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

    Re: Need help with dynamic named ranges and medians based on specific criteria

    That's good to hear, and thanks for the rep.

    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 in this thread, and mark the thread as SOLVED.

    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. [SOLVED] Userform with Cascading Combo Boxes Based on Dynamic Named Ranges...
    By halee66778 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-21-2019, 03:26 PM
  2. Dynamic named range based on two criteria
    By Samantha McNeill in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-20-2018, 06:14 AM
  3. [SOLVED] listing array values in a dynamic list based on 2 criteria from ranges
    By lkeltner in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-14-2016, 01:45 PM
  4. [SOLVED] Medians for Incremental Ranges
    By Tams80 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-29-2014, 10:45 AM
  5. Creating a dynamic set of Named ranges, based on the row count.
    By sdingman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2013, 11:32 AM
  6. Dynamic sumif ranges based on Hlookup criteria
    By Dial1 in forum Excel General
    Replies: 2
    Last Post: 10-24-2011, 01:21 AM
  7. Named ranges-Should I use a dynamic named range
    By foseco in forum Excel General
    Replies: 4
    Last Post: 06-11-2009, 03:56 PM

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