+ Reply to Thread
Results 1 to 9 of 9

Find last 20 values in column

  1. #1
    Registered User
    Join Date
    03-05-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Find last 20 values in column

    Hi Guys,
    I have a single column of numbers ~100 rows high.. Each week an extra number is added at the bottom of the list. Not all cells have values in them but I need to do calculations on the last 20 cells that do have values in them..

    Thanks,
    Doggy

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find last 20 values in column

    A few ways, one might be:

    Please Login or Register  to view this content.
    Note: I'm curious that you say you have 100 rows but that new numbers are added each week... the implication is that the size of the range is not fixed.

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Find last 20 values in column

    Along similar lines:

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    03-05-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find last 20 values in column

    Thanks guys...
    Just reading back over my post, I don't think I explained it very well..
    The formula I need is for a golf handicapping system..
    How it works is that each player's score 'over par' each week is put in the next cell down, eg, if a player scores 90 on a course rated at 72, then his score for that game is 18..(if a particular player doesn't play the cell is left blank.)
    To calculate the player's handicap, his 20 most recent scores are taken, of which the 10 lowest scores are added together, multiplied by 0.96, divided by 10 and then the integer of that is his 'new' handicap..
    So it's a 'rolling' handicap system..

    I hope that makes a bit more sense..

    Thanks again,
    Doggy

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find last 20 values in column

    If I've understood...

    =INT((0.96*SUMPRODUCT(SMALL(INDEX($A$1:$A$100,LARGE(INDEX(ISNUMBER($A$1:$A$100)*ROW($A$1:$A$100),0),MIN(20,COUNT($A$1:$A$100)))):$A$100,ROW($1:$10))))/10)

    Again the ranges will need to be modified I suspect - but try to keep as lean as possible.

  6. #6
    Registered User
    Join Date
    03-05-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find last 20 values in column

    Thanks Donkey, exactly what I was looking for!

    Thanks to you too Sweep!

    Doggy

  7. #7
    Registered User
    Join Date
    10-08-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Find last 20 values in column

    Hi

    Thanks, this was exactly what i was looking for, but want to take it one step further.

    I want to highlight the 20 most recent scores blue and highlight the 10 lowest scores of that 20 scores red.

    I did play around with the conditioning, but could not make it work.

    Thanks in advance

    Also: taking the above formula, i want to to calculate the player's handicap, his 13 most recent scores are taken, of which the 6 lowest scores are added together, multiplied by 0.96, divided by 6.

    I did try
    =INT((0.96*SUMPRODUCT(SMALL(INDEX($A$1:$A$100,LARGE(INDEX(ISNUMBER($A$1:$A$100)*ROW($A$1:$A$100),0),MIN(13,COUNT($A$1:$A$100)))):$A$100,ROW($1:$6))))/6)

    but it don't work.
    Last edited by Vercogen; 10-10-2012 at 05:29 PM.

  8. #8
    Registered User
    Join Date
    10-08-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Find last 20 values in column

    B
    Bump
    m
    p

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Find last 20 values in column

    Vercogen,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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