+ Reply to Thread
Results 1 to 6 of 6

Count the number patterns that occur within a rolling 12 month period

  1. #1
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Count the number patterns that occur within a rolling 12 month period

    Hi All

    I have attached an example workbook which I need help on. The workbook has a userform which will allow the user to select a named person and enter the start date of when a pattern occurred and the number of days that it occurred for. This will then send the data onto two sheets one for availability reasons and the other to display how many times these patterns occur over.
    I’m after help with the following:
    If the pattern falls more than 12 months from today’s date it is highlighted in grey as it is considered as historic
    If the pattern falls within the last 12 months from today’s date is considered current so highlighted in Yellow
    I have tried the following formula for conditional formatting but I can’t get it to work: (unable to post code at the moment)

    I’m not sure if my second ask is even possible! Is it possible to count the number of periods "P" has been entered where they fall within the last 12 months, A period would be classed as consecutive days as highlight in yellow where by weekends and cells contain "U" are ignored. The number of days in the patterns is not important, it’s the number of patterns that matter. I'm assuming that a macro would be the best option because of the potential size of the ask.

    Thanks
    Attached Files Attached Files
    Last edited by C J W; 02-16-2017 at 07:47 PM. Reason: Added attachment

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Count the number patterns that occur within a rolling 12 month period

    You could put the green weekend in one condition
    =OR(WEEKDAY(B$1)=7,WEEKDAY(B$1)=1)

    Grey cells with "P" and older than one year
    =AND(B5="P",B$1 < DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY())))

    Yellow cells with "P" and within one year
    =AND(B5="P",B$1 < TODAY())

    You wouldn't have to set a one year limit for the yellow cells as the Grey condition has priority if it's before the yellow condition.

    I'll have to think about your second ask.

    FYI: the forum's security doesn't seem to allow posting HTML code and it thinks a < or > character is HTML code. Just put a space on either side of those characters and it should allow it.
    Last edited by AlphaFrog; 02-16-2017 at 11:44 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Re: Count the number patterns that occur within a rolling 12 month period

    Thanks for formula for the formatting.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Count the number patterns that occur within a rolling 12 month period

    As to counting the number of periods, see if the following solution will work. There are helper rows at the bottom of the worksheet, row 1048563 and down, populated by the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The number of periods is then displayed in cells QB5:QB18.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Re: Count the number patterns that occur within a rolling 12 month period

    thank you for the formula, just what I needed.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Count the number patterns that occur within a rolling 12 month period

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. [SOLVED] Count days in a rolling 12 month period
    By mlafrance in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-30-2023, 07:45 AM
  2. Count Number of Days, In a rolling 12 month period
    By ExcelNewbie1977 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-19-2016, 03:29 AM
  3. [SOLVED] Count the number of time a month and year occur in a column
    By jh51745 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-17-2015, 09:17 AM
  4. Replies: 10
    Last Post: 01-09-2014, 07:04 PM
  5. Count number of networkdays for each month in a multi month period
    By dreddster in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-10-2013, 11:12 AM
  6. How to count dates in a 12 month rolling period
    By butlej6 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 06-05-2008, 06:00 PM
  7. How do I count dates in a 12 month rolling period?
    By butlej6 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-05-2008, 05:25 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