+ Reply to Thread
Results 1 to 6 of 6

Count the number of occurrences of a particular item in the past 365 days.

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    Count the number of occurrences of a particular item in the past 365 days.

    I have a very large database for new and current customers. I am trying the figure the number of times a new customer has placed an order in the previous 365 days.

    For example, assume the new client has placed an order on the following 5 days:
    03/28/2013
    12/25/2013
    03/05/2014
    03/12/2014
    04/08/2014

    If I were asked on 4/8/14 how many orders has the new client made in the past 365 days from 4/8/14, including 4/8/14, the answer would be 4. It is 4 because the order on 3/28/13 is more 365 days from 4/8/14. I also want to display the oldest order, which would be the first order within 365 days from most recent order. In this case, the oldest order within 365 days of 4/8/14 is 12/25/13

    Not sure if there is way to do this, but I have attached a sample spreadsheet with desired output. Desired output for Orders Received in Last 365 Days is in column G. Desired output for the Oldest Order within 365 days of Current Order is in column H. Thanks.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Count the number of occurrences of a particular item in the past 365 days.

    Hi
    G2 cell
    =IFERROR(SUMPRODUCT((F$2:$F2<=F2)*(F$2:$F2>=(F2-365))),"")

    H2 cell
    =IFERROR(SMALL(IF((F$2:$F2<=F2)*(F$2:$F2>=(F2-365)),$F$2:$F2,""),1),"")
    Second formula is an array. Hit ctrl+Shift+Enter
    Appreciate the help? CLICK *

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Count the number of occurrences of a particular item in the past 365 days.

    Try this formula in G2 and copy down.

    Please Login or Register  to view this content.
    And for the oldest order, try this Array Formula in the cell H2. Since this is an array formula so you need to confirm it with Ctrl + Shift + Enter instead of just Enter. (i.e. hold down Ctrl + Shift and then press Enter)

    Please Login or Register  to view this content.
    Last edited by sktneer; 04-13-2014 at 03:03 AM.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    Re: Count the number of occurrences of a particular item in the past 365 days.

    Thanks for comments. I ended up using sktneer's suggestion in the end.

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Count the number of occurrences of a particular item in the past 365 days.

    Glad to help you. Thanks for the feedback and rep.

  6. #6
    Registered User
    Join Date
    07-01-2015
    Location
    St Louis MO
    MS-Off Ver
    2013
    Posts
    3

    Re: Count the number of occurrences of a particular item in the past 365 days.

    Deleted this is the wrong thread

+ 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. [SOLVED] Count number of occurrences but if there are consecutive matches count them as one
    By michaljireht in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-26-2013, 08:26 PM
  2. [SOLVED] count number of days item in use
    By nigelog in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-26-2013, 10:52 AM
  3. Number of days absent in the past 90 days
    By pumpkinalden in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 07-19-2012, 08:01 PM
  4. Determining If Occurrences Exist Within Past 30 Days
    By amsnss in forum Excel General
    Replies: 1
    Last Post: 01-05-2012, 05:19 PM
  5. Count Number of days from the most recent item
    By batman1056 in forum Excel General
    Replies: 6
    Last Post: 12-15-2011, 09:57 AM

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