+ Reply to Thread
Results 1 to 16 of 16

Counting dates as months formula

  1. #1
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Counting dates as months formula

    Hi all

    Is it possible to count dates from multiple columns up as months.

    This mean you can round up all the dates into a number in a month.

    For example 6 dates recorded to show as a month with the total of 6 instead on another tab?

    I have 4 columns which has dates (tab 2 full of data) in which I would like to add up and show on tab 1 the total number of dates inside a month and record that.

    Not sure I'm making any sense, so adding an example to this post of what I am trying to do.

    Any ideas or help would be most welcome

    Many thanks
    Attached Files Attached Files
    Last edited by MattExcelLearner; 11-02-2018 at 06:01 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: Counting dates as months formula

    Suggest you post a sample with your expected results. Why are the months listed twice? It might make things simpler if the months listed on Sheet1 were actual dates formatted to show the month and maybe the year.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Counting dates as months formula

    I did something with a Pivot Table for one of the dates.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Re: Counting dates as months formula

    Hi TMS

    For example September should give a result of 8

    Column E for September has 2
    Column G for September has 0
    Column I for September has 4
    Column K for September has 2

    This means in tab 1 the result for September should be 8

    Does that help to make sense?

    Regards

  5. #5
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Re: Counting dates as months formula

    pivot is a great idea but September is only showing as 2 rather than 8 that took place when doing an individual count from the data tab

  6. #6
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Counting dates as months formula

    Quote Originally Posted by MattExcelLearner View Post
    pivot is a great idea but September is only showing as 2 rather than 8 that took place when doing an individual count from the data tab
    I only did one of the date fields. You would need a Pivot Table for each date field then add the month totals together.

  7. #7
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Re: Counting dates as months formula

    Tried to replicate with Define but couldn't, how did you get to just show the month rather than the dates in pivot?

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Counting dates as months formula

    Please try at Sheet1 B4 and drag down

    =SUMPRODUCT((TEXT(Table_owssvr[[Initiate Health Check]:[Closure Health Check]],"mmmmyy")=A4&18+INT((ROWS(B$4:B4)-1)/12))*{1,0,1,0,1,0,1})

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: Counting dates as months formula

    @Bo_Ry: neat solution

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Counting dates as months formula

    TMS, Thank you for the rep. I learn a lot by reading your Post, specially VBA part.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counting dates as months formula

    A bit longer. Assumes the first set of 12 months is 2017.

    =INDEX(FREQUENCY(CHOOSE({1,2,3,4},Table_owssvr[Initiate Health Check],Table_owssvr[Define and Design Health Check],Table_owssvr[Build and Deliver Health Check],Table_owssvr[Closure Health Check]),EOMONTH(DATE(2017+COUNTIF($A$4:A4,A4)-1,MONTH(A4&0),1),{-1,0})),2)

    I like Bo_Ry's better.
    Dave

  12. #12
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Re: Counting dates as months formula

    Thanks Bo_Ry this works really well on the example data count spreadsheet.

    I have been trying for days to get it to work on the actual spreadsheet but it doesn't like the table name even though they are the same.

    I also tried changing the column looks to match the example you gave in the actual spreadsheet but doesn't seem to work.

    Would you know why?

    Many thanks
    Attached Files Attached Files

  13. #13
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Counting dates as months formula

    Slightly change
    From
    =SUMPRODUCT((TEXT(Table_owssvr[[Initiate Health Check]:[Closure Health Check]],"mmmmyy")=A4&18+INT((ROWS(B$4:B4)-1)/12))*{1,0,1,0,1,0,1})


    To B9
    =SUMPRODUCT((TEXT(Table_owssvr_4[[Initiate Health Check]:[Closure Health Check]],"mmmyyyy")=B$8&$A8)*{1,0,1,0,1,0,1})

  14. #14
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Re: Counting dates as months formula

    Awesome BO_RY

    I don't really understand the formula but got it to work for 2018 using the slight change.

    I also did the same thing and used it for 2019 and that worked to, so that was amazing.

    If I wanted to do the same thing, but this time instead of Initiate Health Check to Closure Health Check dates use the Initiate Sign off to Closure Sign off would that show the sign off dates per month?

    Long shot but like this:

    =SUMPRODUCT((TEXT(Table_owssvr_4[[Initiation Sign off]:[Closure Sign off]],"mmmyyyy")=B$8&$A8)*{1,0,1,0,1,0,1})

  15. #15
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Counting dates as months formula

    Yes, that should work,

    The trick for {1,0,1,0,1,0,1} 1 is for column that you want to count and 0 is not count
    Header.jpg

    And Header in sheet KPI B$8&$A8 = Jan2018
    TEXT(...,"mmmyyyy") "mmmyyyy" need to match with that header

  16. #16
    Forum Contributor
    Join Date
    09-19-2018
    Location
    England
    MS-Off Ver
    O365
    Posts
    266

    Re: Counting dates as months formula

    That's what I thought, it looks like it did work

    Many thanks buddy, just got to get my =sumproduct to work now and it will be a happy morning hehe

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. counting months between dates and returning a decimal
    By Mycotopian in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 09-12-2023, 01:09 AM
  2. Counting the occurence of particular months in a column of dates
    By Dhabitude in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-21-2015, 07:17 AM
  3. Help! Counting/Tally Months from Dates
    By ShadyRod in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-19-2014, 01:24 PM
  4. [SOLVED] Formula for counting number of months between 2 dates
    By yeosh in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-23-2013, 06:35 PM
  5. Counting Dates Six months in advance
    By nawas in forum Excel General
    Replies: 1
    Last Post: 11-03-2011, 07:27 AM
  6. Excel 2007 : Counting Dates within Months Help
    By Rino468 in forum Excel General
    Replies: 10
    Last Post: 11-01-2010, 02:45 PM
  7. [SOLVED] counting dates in a column that less than 6 months from today
    By Kaye in forum Excel General
    Replies: 2
    Last Post: 02-11-2006, 03:15 PM

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