+ Reply to Thread
Results 1 to 2 of 2

Formula to count a data point in the last nth number of observations in a column

Hybrid View

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Formula to count a data point in the last nth number of observations in a column

    Good Afternoon All,

    This is my issue:

    I have a workbook containing two columns of data to which I add rows of data every day. I currently employ a formula to count the last nth (last 5, last 10, last 15 etc) number of observations in the column:

    =SUM(INDEX(L90:L324,MATCH(9.99999999999999E+307,L90:L324,1)):INDEX(L90:L324,MATCH(9.99999999999999E+307,L90:L324,1)-9,0))

    This formula will sum the values of the last 10 observations in my dataset (COLUMN B below, total observations in column B is over 1000). What I want to now do is only sum the last nth values in Column B which meet a specific criteria. So for example, in the extract below, I want excel to count the last 3 observations in column B where the criteria is met in column A. So lets say the criteria is 1.75, I would want excel to count the last 3 observations in column B where column A = 1.75 - I would expect a total of 3 + 7 + 3 = 13. I have tried variou sumifs but to no avail

    A B
    1.65 4
    1.4 5
    1.6 4
    1.75 3
    1.65 4
    1.6 6
    1.85 7
    1.75 3
    1.75 7
    1.85 4

    Thanks for reading my post and any help would be appreciated.

    RS
    Last edited by RS SINGH; 02-20-2013 at 07:40 PM.

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Formula to count a data point in the last nth number of observations in a column

    Hello RS, try this...

    =SUMPRODUCT((A2:A10=1.75)*(ROW(A2:A10)>=LARGE((A2:A10=1.75)*ROW(A2:A10),3)),B2:B10)

    Adjust the ranges.

    If range doesn't have at least three 1.75 values in A2:A10, will give an error.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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