abunce

Q: returning a count from months

I am looking to return a count from months.  Example:

1/12/16

1/14/16

2/14/16

3/5/16

 

If these were in the same column I would want to return 2 for jan, 1 for feb, and 1 for march.

 

can anyone help me understand how to do this?

Posted on Sep 2, 2016 9:14 PM

Close

Q: returning a count from months

  • All replies
  • Helpful answers

  • by Wayne Contello,

    Wayne Contello Wayne Contello Sep 2, 2016 9:39 PM in response to abunce
    Level 6 (18,960 points)
    iWork
    Sep 2, 2016 9:39 PM in response to abunce

    ad an extra column and use the function month() to get just the month

     

    then summarize by month by using the countif() function... like this:

     

    Screen Shot 2016-09-02 at 11.39.18 PM.png

     

    In the table on the left (named "Data") add a column (column B) and add the formula...

    B2=IF(COUNTA(A2)>0, MONTH(A2), "")

    this is shorthand for... select cell B2 then type (or copy and paste from here) the formula:

    =IF(COUNTA(A2)>0, MONTH(A2), "")

    select cell B2, copy

    select cells B2 thru the end of column B, paste

     

    now add second table (on the right in the screenshot above, titled "Date Summary")

    in column place the month number as shown

    B2=COUNTIF(Data::B, A2)

     

    select cell B2, copy

    select cells B2 thru the end of column B, paste

  • by SGIII,

    SGIII SGIII Sep 3, 2016 6:37 PM in response to abunce
    Level 6 (10,622 points)
    Mac OS X
    Sep 3, 2016 6:37 PM in response to abunce

    If you like a compact approach you can do this with one formula, no extra columns, like this:

     

    Screen Shot 2016-09-03 at 9.28.22 PM.png

     

    The formula in B2, filled down, is:

     

    =COUNTIFS(Table 1::A,">="&A2,Table 1::A,"<"&EDATE(A2,1))

     

    COUNTIFS works with column-condition pairs.  In this case it counts values in column A of Table 1 that are greater than or equal to the date to its left in the second table, and less then a month after the date to its left. (The EDATE simply adds 1 month here).

     

    When you enter a month name column A the smart date recognition in Numbers interprets it as the beginning of the month.  Note that this works "within the same year".  If you change years you'll want to enter a full date in column A (i.e. including year, month, and date) then format so just the month name is showing.

     

    SG