+ Reply to Thread
Results 1 to 6 of 6

Median and If

  1. #1
    Registered User
    Join Date
    05-04-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    3

    Median and If

    Hi,
    I'm trying to figure out how to calculate the median $ of several departments by using the IF statement but have been getting #Num! messages as well as incorrect numbers. I did hit CTR-SHFT-ENTER at the end of the formula.

    =MEDIAN(IF($A:$A="A",$B:$B))

    I've attached a sample of my spreadsheet. I used $ in front of the column as the number of rows will always be changing.

    Any insight would be appreciated.

    Thanks.Excel Help.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Median and If

    something is up with your sheet A doesnt respond as A
    The Importance of INDEX - A GUIDE TO INDEX'S OTHER USES
    <--- If a post helps hit the star

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,696

    Re: Median and If

    You have "trailing spaces" in the column A data. Either get rid of those with Edit > Replace or use TRIM in the formula, e.g.

    =MEDIAN(IF(TRIM($A:$A)="A",$B:$B))

    confirm with CTRL+SHIFT+ENTER

    It will be quicker, though, if you use a smaller range rather than the whole column....
    Audere est facere

  4. #4
    Registered User
    Join Date
    05-04-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Median and If

    Sorry, my mistake.
    Should have explained the situation better.
    I've downloaded a huge list of data using Live Office.
    From this list and on a separate worksheet, I am trying to calculate the median $ for each department. However, when I try to use the IF statement with MEDIAN, I either get an incorrect median, #NUM! or $Value.
    I've attached a simple, shortened sample of the list with just 2 columns in 1 worksheet and the summary table in another.


    Any help is much appreciated.

    Excel Help.xlsx

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Median and If

    I get the correct answers using an arrayed

    =MEDIAN(IF(TRIM($A:$A)=E1,$B:$B))
    For A, E and M in your spreadsheet, I get 30,000, 47,250 and 1923.75. (Excel averages middle two values if the range has an even number in it)
    Does that help?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Registered User
    Join Date
    05-04-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Median and If

    Thanks. The formula works fine with the sample spreadsheet but not with my original live office excel report. I'm still getting $0 or an incorrect median. It may have something to do with how the formula is reading the data transferred over from web intelligence via live office.

    At least I know how to create the formula. Now I just have to drill down on the live office part.

    Thanks for everyone's help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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