+ Reply to Thread
Results 1 to 5 of 5

Function - Counting Years in range

  1. #1
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Function - Counting Years in range

    Hi,

    I've got a list of around 300 dates Format e.g 01/07/2006 for different years. Also some entries have ' in front of them to make them text

    I want to count the number of dates in say A2 to A300 (may have blanks) and then count the how many in current year 2006.

    Would like it to return something like "There are 200 entries in current year out of 299".

    Thanks in advance

    VBA Noob

  2. #2
    Bondi
    Guest

    Re: Function - Counting Years in range


    VBA Noob wrote:
    > Hi,
    >
    > I've got a list of around 300 dates Format e.g 01/07/2006 for different
    > years. Also some entries have ' in front of them to make them text
    >
    > I want to count the number of dates in say A2 to A300 (may have blanks)
    > and then count the how many in current year 2006.
    >
    > Would like it to return something like "There are 200 entries in
    > current year out of 299".
    >
    > Thanks in advance
    >
    > VBA Noob
    >
    >
    > --
    > VBA Noob
    > ------------------------------------------------------------------------
    > VBA Noob's Profile: http://www.excelforum.com/member.php...o&userid=33833
    > View this thread: http://www.excelforum.com/showthread...hreadid=562126


    Hi,

    Maybe you can use something like:

    ="There are
    "&SUMPRODUCT(--(RIGHT(TEXT(A2:A300,"dd/mm/yyyy"),4)="2006"))&" entries
    in current year out of "&COUNTA(A2:A300)

    Regards,
    Bondi


  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Thanks

    Worked a treat.

    I got the right function and count function part but it was how to sum them that stump me was trying Countif

    VBA Noob

  4. #4
    Dave Peterson
    Guest

    Re: Function - Counting Years in range

    Another alternative...
    =SUMPRODUCT(--(TEXT(A2:A300,"yyyy")="2006"))
    or
    =SUMPRODUCT(--(year(A2:A300)=2006))



    Bondi wrote:
    >
    > VBA Noob wrote:
    > > Hi,
    > >
    > > I've got a list of around 300 dates Format e.g 01/07/2006 for different
    > > years. Also some entries have ' in front of them to make them text
    > >
    > > I want to count the number of dates in say A2 to A300 (may have blanks)
    > > and then count the how many in current year 2006.
    > >
    > > Would like it to return something like "There are 200 entries in
    > > current year out of 299".
    > >
    > > Thanks in advance
    > >
    > > VBA Noob
    > >
    > >
    > > --
    > > VBA Noob
    > > ------------------------------------------------------------------------
    > > VBA Noob's Profile: http://www.excelforum.com/member.php...o&userid=33833
    > > View this thread: http://www.excelforum.com/showthread...hreadid=562126

    >
    > Hi,
    >
    > Maybe you can use something like:
    >
    > ="There are
    > "&SUMPRODUCT(--(RIGHT(TEXT(A2:A300,"dd/mm/yyyy"),4)="2006"))&" entries
    > in current year out of "&COUNTA(A2:A300)
    >
    > Regards,
    > Bondi


    --

    Dave Peterson

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Thanks Dave

+ 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