+ Reply to Thread
Results 1 to 4 of 4

How do I use autofill to change the dates in a COUNTIF formula?

  1. #1
    Registered User
    Join Date
    07-15-2010
    Location
    Centreville, VA
    MS-Off Ver
    Excel 2003
    Posts
    3

    How do I use autofill to change the dates in a COUNTIF formula?

    How do I use autofill to change the dates in a COUNTIF formula? Example:
    A1 cell: =COUNTIF(B1:B100, "1/1/2010")
    A2 cell: =COUNTIF(B1:B100, "1/2/2010")

    I want it to autofill the formula with 1/3/2010, 1/4/2010, etc. when I drag it down, but it just repeats the first 2 dates over and over. Any suggestions? Thanks!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How do I use autofill to change the dates in a COUNTIF formula?

    One way:

    =COUNTIF(B3:B102, ("1/"&ROWS($A$1:$A1)&"/2010")+0)

    copied down

    or

    =COUNTIF(B1:B100,DATE(2010,1,ROWS($A$1:$A1)))

    copied down.

    Actually the second is better...because it will automatically go to next month after the last day.. the first formula is only good for January....
    Last edited by NBVC; 07-15-2010 at 08:36 AM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    07-15-2010
    Location
    Centreville, VA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How do I use autofill to change the dates in a COUNTIF formula?

    Hmmmm, I tried both and neither seemed to work, I was probably doing something wrong...

    I got it to work by puttin this in column B and dragging down:
    =COUNTIF(C$1:C$100, A1)
    =COUNTIF(C$1:C$100, A2)
    etc etc etc

    With Column A being the dates I wished to count and column C being the data counted.
    Thanks!

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How do I use autofill to change the dates in a COUNTIF formula?

    Sorry, I did forget to make the range absolute:

    =COUNTIF($B$1:$B$100,DATE(2010,1,ROWS($A$1:$A1)))

    this checks that the date in B1:B100 is Jan 1, 2010, as you copy down it should count Jan 2, 2010, etc...

    Ignore the first formula.. it is not good.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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