+ Reply to Thread
Results 1 to 4 of 4

count occurrences before/less than given value across sheets

  1. #1
    Registered User
    Join Date
    10-15-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    count occurrences before/less than given value across sheets

    Hi all

    I would like to ask for advice for following problem (Excel 2007)...

    I have two sheets (tables). In sheet 1 I have data in two columns: column A has 4-digit identifiers for individuals (e.g. 9841, 8436, 7459), column B has data of years (e.g. 2003, 2004, 2005). Individuals may occur repeatedly if they had events in multiple years.

    For example,
    ...

    7459 1995

    9841 2003
    9841 2005
    9841 2010

    8436 2001
    ...

    Then I have another sheet where I have the year of an event in column A (e.g. 2008). In a second column B I have individual identifiers again (e.g. 9841). In a third column C I would like to be able to calculate how many events are known in the first sheet for that individual before the event in column A. So in my example, how often does individual 9841 occur before 2008? The answer I would like to have computed: 2 (i.e. 2003 and 2005).

    2008 9841

    I have tried various things for quite some time now, including countifs and <, but for some reason it does not work.

    Any thoughts?
    Thanks in advance, N

  2. #2
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: count occurrences before/less than given value across sheets

    In the other sheet,
    you could try this in C2:
    =SUMPRODUCT((Sheet1!$A$2:$A$100=B2)*(Sheet1!$B$2:$B$100<A2))

    ----
    Success? Celebrate it, click the star at the bottom left of my response

  3. #3
    Registered User
    Join Date
    10-15-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: count occurrences before/less than given value across sheets

    Thank you, that helped.

    N

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: count occurrences before/less than given value across sheets

    The alternative available to you in Excel 2007 would be:

    =COUNTIFS(Sheet1!A:A,B2,Sheet1!B:B,"<"&A2)

+ 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