+ Reply to Thread
Results 1 to 13 of 13

Median function ignoring zero

  1. #1
    Registered User
    Join Date
    01-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Microsoft Office 2011
    Posts
    6

    Median function ignoring zero

    Hi, I am trying to run a function (in this case Median) on discrete values, not an array (eg A2, A6, A10, A12, NOT A2:A12).
    I have tried using the View preferences and un-checking the "Show zero values" box. But, my formula still seem to include the cells that are now blank (but are hiding zero's).
    I also can't work out how to modify an Array function of this sort:
    =MEDIAN(IF(A1:A10>0,A1:A10))
    ->using CTRL + SHIFT + ENTER
    Given that i have a number of discrete cells (A2, A6, A10, A12 etc)
    Any help would be much appreciated!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Median function ignoring zero

    Hi robin and welcome to the forum,

    The obvious answer is:

    =MEDIAN(A2,A6,A10,A12)

    But you must mean that one of the cells is zero? Perhaps?

    If you force one of the A2, A6, A10 or A12 to text the formula gives #Value.
    Can you be more exact on what values (or text) the above 4 cells might have.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Median function ignoring zero

    For array function it is 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. Press F2 on that cell and try again.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    01-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Microsoft Office 2011
    Posts
    6

    Re: Median function ignoring zero

    thanks Marvin.
    To clarify all data are digits/numbers. When i write zero, i mean "0". Sorry if that was the confusion.
    Yes, as you say, I have cells that sometimes have 0 values that i don't want to include in my calculation.
    So all data will be numbers. Some of the data will be 0's that i don't want included in the calculation. But i will be cutting& pasting this formula into multiple spreadsheets, and i won't know in advance where the 0 values i want excluded will be.
    I hope that gives a better idea of what i'm trying to do.

    (I had found in another forum that by hiding 0 values, that the formula would ignore 0's. But I find it still includes them as 0 in the data set.
    eg. Median of 0, 2, 4 -> if we hide/ignore the 0, should be 3. But my formula still says it's 2.)

  5. #5
    Registered User
    Join Date
    01-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Microsoft Office 2011
    Posts
    6

    Re: Median function ignoring zero

    thanks for responding humdingaling.
    Yes i've already been using CTRL+SHIFT+ENTER for my array functions.
    Currently, i'm not getting any error messages, I just can't get the the function to ignore my 0's. Nor can i come up with a IF type of function that will work.

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Median function ignoring zero

    attached file contains manual method of median and one with CSE

    both generate same answer when random numbers are updated?
    Attached Files Attached Files
    Last edited by humdingaling; 01-12-2016 at 01:56 AM. Reason: updated with 0,2,4 example

  7. #7
    Registered User
    Join Date
    01-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Microsoft Office 2011
    Posts
    6

    Re: Median function ignoring zero

    Firstly - thanks so much humdingaling!
    This forum is awesome.
    Your file is good for when i want to calculate all data A1:A10 (ignoring 0's).
    However, see attached, my problem is that I want to select specific cells (ignoring 0's
    within this set), but he cells in between this set also contains data that i want to ignore regardless
    of its content.
    I've attached some example data that i need solving for.
    Robin5_example.xlsx

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Median function ignoring zero

    you should lead with something more representative of your actual problem next time

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


    now i can also assume that "data" isnt going to be what your actually have so how is "data" and "not Data" actually defined


    attached something that explains abit more of whats going on
    Attached Files Attached Files
    Last edited by humdingaling; 01-12-2016 at 02:43 AM. Reason: deleted long form of the formula...no point having it there

  9. #9
    Registered User
    Join Date
    01-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Microsoft Office 2011
    Posts
    6

    Re: Median function ignoring zero

    thanks for bearing with me.
    Yes, you're quite right, i've tried to simplify my data.
    My actual data is rather complicated - it is data with a bunch of different conditions.

    I've attached an example if you dare to look. Basically, if we just look at the purple cells - directed
    by the formula in M4, hopefully you'll get the gist:
    For the condition "Congruent - No Cue" i want to get the Median of these cells:
    F6,F12,F126,F132,F250,F256,F370,F376, ignoring any 0's)
    These cells are taken from all variations of "Congruent - No cue" ie COngr - no cue left, Cong - no cue right, etc

    Sorry that data is pretty complicated for an outside observer (it's basically data from a visual experiment,
    where participants press left or right arrow keys depending on what visual targets they see)

    If the only way is to set up something like your last attachemnt - it might be too complicated for my dataset.
    In which case it might be easier for me to select and export the data i want, and format it so that each set of
    data is together (ie A1:A10 etc).
    Thanks!
    Robin5_example.xlsx
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Median function ignoring zero

    yes i see why you started out the way you did
    this is a very different kettle of fish

    let me a have a think about it and see what i would do in your case
    it definitely would not be the solution offered previously

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Median function ignoring zero

    excuse the essay but im guessing you want a break down on whats happening
    right, without resorting to VBA

    here is what i came up with
    A series of 5 helper columns (its a lot but its due to how your data is output) to pipe out the corresponding numbers to the each stimulus
    3 helpers is just to define exactly what each stimulus result you are looking at
    Congruent, Incongruent or Neutral
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    this formula looks for the 3rd " " (space) in the stimulus title to start the MID formula and the length is determined by finding the 4th minus the 3rd

    i had to do some data entry to your stimulus as some of them had uneven spacing
    ie i change "Stim14 - Up Incongruent- Double Cue - RIGHT" to "Stim14 - Up Incongruent - Double Cue - RIGHT"
    ***this is an important step for you to clean up the stimulus titles or else it will give incorrect outputs

    second helper is to extract
    No Cue, Central Cue, Double Cue, Spatial Cue
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    same idea as above but using "-" instead of space

    third helper is to extract left or right
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ^the simple version of this formula is it just trims off everything the final "-"
    in this case...its either left or right

    4th and 5th checks on 3rd helper column to find out where to take the value from
    nEvents is
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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


    now it seems daunting to begin with but its rather simple as a template you can apply ongoing (of which you can hide the columns)

    all this accumulates to final formula which are both CSE
    mean RT is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


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


    column u and V are just check boxes for you to know the formula pumps out the same numbers are your other method

    you will see it clearly on the file attached
    Attached Files Attached Files
    Last edited by humdingaling; 01-12-2016 at 08:06 PM. Reason: grammar

  12. #12
    Registered User
    Join Date
    01-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Microsoft Office 2011
    Posts
    6

    Re: Median function ignoring zero

    wow. That is so good! Thanks humdingaling.
    Can't thank you enough for whipping that up so quickly. That spreadsheet is a thing of beauty!
    I just added into the final median calculation an extra qualifier for IF($O$5:$O$488>0) so that it ignores my 0's.

    =MEDIAN(IF($K$5:$K$488=Q30,IF($L$5:$L$488=R30,IF($O$5:$O$488>0,$O$5:$O$488))))
    That's problem solved! Thanks again

  13. #13
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Median function ignoring zero

    not a problem, was a good challenge

    i wasn't sure if you wanted that zero thing in there or not so i excluded it to make the results match your figures

    just remember to keep the stimulus titles in the "same" format or else you may get unexpected results
    you will when it doesn't work in the helper column outputs

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as 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. Median Indirect: Find median in range and bring back adjacent cells
    By Keelin in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 06-27-2014, 08:31 AM
  2. [SOLVED] Formula to get the median, but ignoring the duplicate numbers in the column
    By Rianne in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-16-2013, 03:23 AM
  3. [SOLVED] Median Ifs, need to find median $ amount per deal for each year
    By xenomorph8472 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-13-2012, 02:01 PM
  4. Ignoring Duplicates when Calculating a Median
    By trfarley05 in forum Excel General
    Replies: 3
    Last Post: 06-08-2012, 09:42 AM
  5. Median if - ignoring zeros
    By adame in forum Excel General
    Replies: 1
    Last Post: 05-24-2012, 11:57 AM
  6. median function
    By flyingmeatball in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-17-2006, 12:58 PM
  7. Median ignoring Zero Values
    By tlosgyl3 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-13-2005, 04:14 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