+ Reply to Thread
Results 1 to 5 of 5

COUNT/COUNTIF function with date calculation

Hybrid View

  1. #1
    Registered User
    Join Date
    08-10-2011
    Location
    Melbourne
    MS-Off Ver
    Excel 2002
    Posts
    9

    Question COUNT/COUNTIF function with date calculation

    Good Morning All,

    I'm trying to count cells if a calculated value of two dates meets my criteria.
    For example I have two columns of dates (Date2 and Date1). I want to count if
    Date2 - Date1 = less than 1 year, between 1 and 5 years, between 5 and 10 years, ...
    I can create a third column for Date2-Date1 and use countif to count it but I don't want to do that.

    Date2 Date1
    1/01/2012 1/01/2011
    1/02/2011 30/05/2008
    5/04/2012 1/09/2005

    Any help will be appreciated.


    Cheers,

    Jayana

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: COUNT/COUNTIF function with date calculation

    hi Jayana, so u wanna have 3 formulas? 1 for each criteria separately?
    Less than 1 year:
    1 to 5 years:
    5-10 years:

    u can try this for "Less than 1 year":
    =SUMPRODUCT(1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"m")<12))

    For 1 to 5 years, it overlaps with 5-10 years. so what if u have 1 group that is 5 years? which should it be categorised under?

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    08-10-2011
    Location
    Melbourne
    MS-Off Ver
    Excel 2002
    Posts
    9

    Re: COUNT/COUNTIF function with date calculation

    Hi benishiryo

    Thank for your help. You are absolutely right, I need three formulas in three separate cells and I thing the following criteria should
    address the overlapping issue:

    Less than 1
    1 to less than 5
    5 to less than 10
    10 and over.

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: COUNT/COUNTIF function with date calculation

    try these formulas:

    Less than 1:
    =SUMPRODUCT(1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"m")<12))
    1 to less than 5:
    =SUMPRODUCT(1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"y")<=4)*1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"y")>0))
    5 to less than 10 :
    =SUMPRODUCT(1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"y")>=5)*1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"y")<=9))
    10 and over:
    =SUMPRODUCT(1*(DATEDIF($B$2:$B$4,$A$2:$A$4,"y")>=10))

    let me know if it works

  5. #5
    Registered User
    Join Date
    08-10-2011
    Location
    Melbourne
    MS-Off Ver
    Excel 2002
    Posts
    9

    Talking SOLVED: COUNT/COUNTIF function with date calculation

    Many thanks benishiryo.
    It works perfectly well.

    Jayana

+ 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