+ Reply to Thread
Results 1 to 18 of 18

finding the middle cell in a column of numbers

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Smile finding the middle cell in a column of numbers

    Hi Guys,

    Not sure of the right tiltle here goes

    I am looking for a formulas to first find the middle number in a column of numbers eg 1,2,3,4,5 3 is the middle (similar to median) thats where the calculations start...

    it then assigns values of minus to the numbers above the middle and plus values to the numbers below the middle
    1 -50
    2 -50
    3 0
    4 +50
    5 +50




    now when it comes to even numbers eg 1,2,3,4,5,6 if i use median it divide 3 & 4 and comes up with 3.5 ........ i want it to recognize 3 and 4 as the middle numbers
    and assign plus and minuses above and below the middle numbers
    1 -50
    2 -50
    3 -25
    4 +25
    5 +50
    6 + 50

    I do hope you all understand, this has been buggin me for weeks

    cheers in advance
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Bump
    Bump
    Bump

  3. #3
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Bump

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: finding the middle cell in a column of numbers

    See if this is what you want.

    A5:A10 = numbers
    B5 formula, copied down: =IF(A5<=ROUNDUP(COUNT($A$5:$A10)/2,1),"-"&A5,"+"&A5)

    See attached.
    Attached Files Attached Files

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: finding the middle cell in a column of numbers

    =if(a1<median($a$1:$a$10),a1*-1,a1)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Hi Guys

    thanks for the replys, although I dont really understand what they mean!

  7. #7
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: finding the middle cell in a column of numbers

    To add to your confusion, a third approach.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Smile Re: finding the middle cell in a column of numbers

    Quote Originally Posted by WHER View Post
    To add to your confusion, a third approach.
    WHER, looks like i have found another genius.

    first look; looks like its the ticket, that's what i have been after..........

    I will look into it further and get back to you

    cheers
    stephen

  9. #9
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Hi WHER,

    I feel that I am so close to a sublime moment, I have been trying to combine the two lots of formula without; at the moment sucess.

    any thoughts on combining the odd and even values together, I have tried but cannot get the 0 to show.......... only a -25

    cheers
    Last edited by stephen1000; 09-10-2009 at 08:48 AM.

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: finding the middle cell in a column of numbers

    how about
    =IF(A1="","",IF(ISODD(COUNTA($A$1:$A$10)),IF(A1<MEDIAN($A$1:$A$10),-50,IF(A1=MEDIAN($A$1:$A$10),0,50)),IF(A1=MEDIAN($A$1:$A$10)-0.5,-25,IF(A1=MEDIAN($A$1:$A$10)+0.5,25,IF(A1<MEDIAN($A$1:$A$10),-50,50)))))

  11. #11
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Quote Originally Posted by martindwilson View Post
    how about
    =IF(A1="","",IF(ISODD(COUNTA($A$1:$A$10)),IF(A1<MEDIAN($A$1:$A$10),-50,IF(A1=MEDIAN($A$1:$A$10),0,50)),IF(A1=MEDIAN($A$1:$A$10)-0.5,-25,IF(A1=MEDIAN($A$1:$A$10)+0.5,25,IF(A1<MEDIAN($A$1:$A$10),-50,50)))))
    Hi Martin, thanks for the formula, I have tried it but could not get it to work

    maybe (probably) doing something wrong

    Cheers

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: finding the middle cell in a column of numbers

    i must admit i take it column of numbers is always sequential integers 1,2,3,4,5,6,7,8
    or say 6,7,8,9,10 ?
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Hi Martin

    I see what it does but when i apply it to the main sheet it loses something


  14. #14
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: finding the middle cell in a column of numbers

    Hi Stephen,
    I applied Martin's formula to your workbook, have a look.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Quote Originally Posted by WHER View Post
    Hi Stephen,
    I applied Martin's formula to your workbook, have a look.
    Hey WHER, I applied it to a different workbook it worked, but when I apply the original it does not work....

    I applied what you gave me the other day, but put the even formula into the odd formula I am looking to combine them but one cell wont play ball

    D79

    If you have time to look, would be great.....

    cheers
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: finding the middle cell in a column of numbers

    The formula in D77:D89 seems to do the trick for both even and uneven "cases", but so does Martin's formula.
    Attached Files Attached Files

  17. #17
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: finding the middle cell in a column of numbers

    applied it to a different workbook it worked, but when I apply the original it does not work
    you have merged cells this might be causing problems, repost original without merged cells.

  18. #18
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Norfolk UK
    MS-Off Ver
    2007
    Posts
    222

    Re: finding the middle cell in a column of numbers

    Hey sorry guys

    we had a small fire in the house friday evening, been a bit busy clearing up..


    I will look again at what you guys have posted and reply...


+ 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