+ Reply to Thread
Results 1 to 11 of 11

countif using date range

  1. #1
    Registered User
    Join Date
    05-11-2012
    Location
    Chester, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    countif using date range

    Hi,

    I have the following data:

    A B
    Owned Let Agreed
    N 26/11/2010
    N 30/11/2010
    N 06/12/2010
    N 19/12/2010
    N 20/12/2010
    N 15/01/2011
    N 27/01/2011
    N 29/01/2011
    Y 04/02/2011
    N 23/02/2011
    Y 01/03/2011
    N 11/03/2011
    N 28/03/2011
    N 16/03/2011
    N 30/03/2011
    Y 01/05/2011
    Y 30/05/2011
    Y 08/06/2011
    Y 10/06/2011
    N 10/06/2011
    N 10/06/2011
    Y 10/06/2011
    Y 10/06/2011
    Y 20/06/2011
    N 27/06/2011
    Y 02/07/2011
    N 27/07/2011
    Y 10/08/2011
    N 16/08/2011
    Y 16/08/2011
    N 18/08/2011
    N 16/08/2011
    N 23/08/2011
    N 23/08/2011
    N 23/08/2011

    What I am aiming to do is return the number of properties with lets agreed, depending on whether it is owned or not.

    For example, the number of properties which are not owned with lets agreed between 01/01/2011 and 31/01/2011. The answer would be 3.

    I have this formula for the date range:
    =COUNTIF(B:B,"<=" & DATE(2011,1,31))-COUNTIF(B:B,"<" & DATE(2011,1,1))

    I'm just not to sure how to incorporate the other criteria into this formula.

    I'd rather this be in 2 formulas, one for owned properties and one for not owned properties.

    Any help would be greatly appreciated

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: countif using date range

    Try using =COUNTIFS(), it allows for multiple criteria.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: countif using date range

    Using this sample data in A1:B36...
    A B
    Owned Let Agreed
    N 26/11/2010
    N 30/11/2010
    N 06/12/2010
    N 19/12/2010
    N 20/12/2010
    N 15/01/2011
    N 27/01/2011
    N 29/01/2011
    Y 04/02/2011
    N 23/02/2011
    Y 01/03/2011
    N 11/03/2011
    N 28/03/2011
    N 16/03/2011
    N 30/03/2011
    Y 01/05/2011
    Y 30/05/2011
    Y 08/06/2011
    Y 10/06/2011
    N 10/06/2011
    N 10/06/2011
    Y 10/06/2011
    Y 10/06/2011
    Y 20/06/2011
    N 27/06/2011
    Y 02/07/2011
    N 27/07/2011
    Y 10/08/2011
    N 16/08/2011
    Y 16/08/2011
    N 18/08/2011
    N 16/08/2011
    N 23/08/2011
    N 23/08/2011
    N 23/08/2011
    and
    Please Login or Register  to view this content.
    This regular formula, copied down, returns the counts
    Please Login or Register  to view this content.
    Is that somethin you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: countif using date range

    Hi Devski,


    Use the below formula :-

    {=SUM(($A$2:$A$36="N")*($B$2:$B$36>=DATE(2011,1,1))*($B$2:$B$36<=DATE(2011,1,31)))}

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  5. #5
    Registered User
    Join Date
    05-11-2012
    Location
    Chester, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: countif using date range

    Thanks for the replies, the best one for me to use is dilipandey's formula. Thanks anyway to the rest of your responses, they are very much appreciated

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: countif using date range

    cheers

    Regards,
    DILIPandey

    <click on below star if this helps>

  7. #7
    Registered User
    Join Date
    05-11-2012
    Location
    Chester, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: countif using date range

    I have a similar problem to the original, except now, I have the owned column as before, but instead of a column with dates, I have a column which will either contain the word evict or it will be blank.

    What I want to do is to show how many evictions there are, depending on whether the property is owned or not.

    I have this formula for the eviction column:

    =SUM(IF('Rent Balances'!$H$2:$H$59="Evict",1,0))

    This returns how many evictions there are in total. This is not what I want.

    I have tried the following formula which isn't right either:

    =(SUM(('Rent Balances'!$D$2:$D$59="N")*(SUM(IF('Rent Balances'!$H$2:$H$59="Evict",1,0)))))

    What this formula is doing is summing the number of N's and multiplying it by the number of evictions which is 2.

    Is there a formula I can use to do what I want it to do?

    Thanks

  8. #8
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: countif using date range

    Try this:

    For owned: =COUNTIFS('Rent Balances'!$H$2:$H$59,"Evict",'Rent Balances'!$D$2:$D$59,"Y")
    For not owned: =COUNTIFS('Rent Balances'!$H$2:$H$59,"Evict",'Rent Balances'!$D$2:$D$59,"N")
    Last edited by Søren Larsen; 05-23-2012 at 06:01 AM.

  9. #9
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: countif using date range

    Hi Devski,

    Please do not post your query into an existing query of other member...see the forum rules:-

    http://www.excelforum.com/forum-rule...rum-rules.html

    2. Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread.


    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  10. #10
    Registered User
    Join Date
    05-11-2012
    Location
    Chester, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: countif using date range

    Quote Originally Posted by Søren Larsen View Post
    Try this:

    For owned: =COUNTIS('Rent Balances'!$H$2:$H$59,"Evict",'Rent Balances'!$D$2:$D$59,"Y")
    For not owned: =COUNTIS('Rent Balances'!$H$2:$H$59,"Evict",'Rent Balances'!$D$2:$D$59,"N")
    Thanks so much

  11. #11
    Registered User
    Join Date
    05-11-2012
    Location
    Chester, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: countif using date range

    I started this thread though, the rule says
    Don't post a question in the thread of another member.
    But in this case, it's the same member. So really, I'm not breaking the rules.

+ 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