+ Reply to Thread
Results 1 to 5 of 5

Excel formula debugging - Median calculation

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Schaumburg, IL
    MS-Off Ver
    Excel 2007
    Posts
    24

    Post Excel formula debugging - Median calculation

    I need help in proper formula formatting/syntax. I just haven’t been able to debug my formula to calculate a Median.

    Here is a similar working formula that calculates an Average:

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


    I need to modify the above so it calculates a Median.

    I’ve tested this simpler formula for proper format and it works:

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


    I need to replace "date_city!$I$2:$I$989" and "date_city!$E$2:$E$221" from the above Median formula with their corresponding code from the Average formula.

    I tried the following code, but cannot find my errors. Probably incorrect parantheses or comma placement.

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


    Thanks in advance for any help.

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

    Re: Excel formula debugging - Median calculation

    You are using the criteria syntax as per AVERAGEIFS, i.e. "<" & Criteria!$G$4 but in a MEDIAN(IF function that should be just <Criteria!$G$4 - no quotes and no &
    Audere est facere

  3. #3
    Registered User
    Join Date
    02-10-2014
    Location
    Schaumburg, IL
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Excel formula debugging - Median calculation

    Thanks for the reply, daddylonglegs. I made the changes you indicated (no quotes and no &'s), but the Median code still does not work.

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

    Re: Excel formula debugging - Median calculation

    OK, I looked a little deeper and I can see that some of your parentheses are misplaced. This version should work OK as long as you have the same number of populated rows in the date and value columns:

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


    It might be better to use the same COUNTA function in all 3 places because mismatches between those COUNTA results can give you an #N/A error

  5. #5
    Registered User
    Join Date
    02-10-2014
    Location
    Schaumburg, IL
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Excel formula debugging - Median calculation [Solved]

    Much thanks. Your help is greatly appreciated. The code you provided works great.

+ 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. Median Absolute Deviation (MAD) Calculation
    By Arand in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2013, 04:07 PM
  2. Conditoinal median calculation for a series
    By mahershams in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-24-2012, 10:10 AM
  3. Median calculation across two columns
    By captainjazz in forum Excel General
    Replies: 2
    Last Post: 06-21-2011, 10:02 AM
  4. Help with calculation of median
    By sssss in forum Excel General
    Replies: 8
    Last Post: 03-26-2010, 09:43 AM
  5. [SOLVED] How to automate the calculation of the median from a frq distribut
    By Alaska Hydro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2005, 09:10 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