+ Reply to Thread
Results 1 to 13 of 13

Median Indirect: Find median in range and bring back adjacent cells

  1. #1
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Median Indirect: Find median in range and bring back adjacent cells

    All,

    I would like to find the median in a range of cells and then bring back the 2 adjacent cells

    Range...............Adj Cell 1............Adj Cell 2
    1.......................L1......................L2
    2.......................P3......................P4
    3.......................O9......................010

    So the median of the range is 2, thus we would want the formulas to bring back P3 and p4

    Column 1..............Column 2
    P3...........................P4

    Thanks all you really are such a super smart bunch

    Keelin

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Median Indirect: Find median in range and bring back adjacent cells

    If you have an even number of cells the median may not be represented in one of those cells.

    Consider this example:

    Data Range
    A
    1
    1
    2
    2
    3
    3
    4
    4
    5
    ------


    The median is 2.5.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Yes I was just thinking through that, not sure if its possible.......

    Do you think it is it possible to find the closest to the median in the range?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Do you think it is it possible to find the closest to the median in the range?
    Probably.

    In the example I posted which would be the closest?

  5. #5
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: Median Indirect: Find median in range and bring back adjacent cells

    I think I will use a helper column and use a true statement to find the closest one......possibly!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Median Indirect: Find median in range and bring back adjacent cells

    We don't need no stinkin' helper column!

    How about this...

    Find the closest to the median without going over?

    Data Range
    A
    B
    C
    D
    E
    F
    1
    ------
    ------
    ------
    ------
    ------
    ------
    2
    1
    A
    B
    C
    D
    3
    2
    C
    D
    4
    3
    E
    F
    5
    4
    G
    H


    This array formula** entered in E2 and copied to F2:

    =INDEX(B2:B5,MATCH(MAX(IF($A2:$A5<=MEDIAN($A2:$A5),$A2:$A5)),$A2:$A5,0))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  7. #7
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Oh Lordy thats totally awesome

    I only hope that I can do this justice and get it working in the master spreadsheet

    ......I'll try it now and report back

    THANK-YOU SOO MUCH

  8. #8
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Oh its awesome....we are nearly there...

    Although there is a complication, there is a condition on the median,

    e.g. we are calculating the median for the a subdivision, e.g. Finance - Accounting; or Finance - End of Yr

    So I need to build in a condition and I am failing miserably - hence I am back here to leverage the collective genius that is this forum

    My current formula is:

    =IF('DATA MERGE'!D:D=Y5,INDEX('DATA MERGE'!K:K,MATCH(MAX(IF('DATA MERGE'!J:J<=MEDIAN('DATA MERGE'!J:J),'DATA MERGE'!J:J)),'DATA MERGE'!J:J,0)))

    Essentially I need to build in an if a condition to evaluate if a value column d of data merge meets the condition of cell Y5

    Any help would be GREATLY appreciated

    Thanks

    Keelin

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Starting to get kind of gnarly.

    You should avoid using entire columns as range references in array formulas and the SUMPRODUCT function. Use smaller specific ranges.

    Array entered**:

    =INDEX('DATA MERGE'!K2:K25,MATCH(MAX(IF('DATA MERGE'!$D2:$D25=$Y5,IF('DATA MERGE'!$J2:$J25<=MEDIAN(IF('DATA MERGE'!$D2:$D25=$Y5,'DATA MERGE'!$J2:$J25)),'DATA MERGE'!$J2:$J25))),IF('DATA MERGE'!$D2:$D25=$Y5,'DATA MERGE'!$J2:$J25),0))

    Copy across as needed.

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  10. #10
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Thanks so much

    Its bringing back a value but not the right one for me -----I have been staring at the screen for too long.

    I have attached an example of what I am trying to do with the example sheets and model that I am using

    Would you mind having a look to see if I am going mad?

    Thanks so much,

    Keelin

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Sorry, the file is too big for me.

    If you can make up a SMALL sample file where the data is all on one sheet, so that I don't have to scroll to see/find the data, then I'll take a look. 20 rows and a few columns is plenty of data. That would be about 10kb file size.

  12. #12
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Ahh soo sorry I did in haste and forgot it had all of the formula's still in it!

    Thanks so much for having a look, its about as small as I can get it now (still 100kb though is that ok?)

    Thanks so very much,

    K

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Median Indirect: Find median in range and bring back adjacent cells

    Ok, I downloaded your file.

    What are the conditions for the median?

    I see you have a small range highlighted, D9:H13.

    The formulas in columns E and F are returning #N/A errors because they reference an external file which I do not have.

+ 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. Formula to find Median of Quartile Range
    By Steve N. in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2013, 09:45 PM
  2. [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
  3. [SOLVED] Find Median of Positive numbers only in Range
    By MichaelC in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  4. [SOLVED] Find Median of Positive numbers only in Range
    By MichaelC in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  5. Find Median of Positive numbers only in Range
    By MichaelC in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-23-2005, 11:05 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