+ Reply to Thread
Results 1 to 6 of 6

How to Count Periods of Activity

  1. #1
    Registered User
    Join Date
    01-29-2015
    Location
    Wigan, England
    MS-Off Ver
    7
    Posts
    10

    How to Count Periods of Activity

    Good morning!

    I need a formula to be able to count periods of activity.

    Using the table below as an example, activity is denoted by the letter 'M'. The 'M's against Jan, Feb and Mar would be classed as 1 single period of activity. Across the whole year there are 3 periods of activity.

    Activity Formula.jpg

    Does anyone know of a formula that would be able to calculate this please?

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: How to Count Periods of Activity

    This Macro would do it for your example

    Please Login or Register  to view this content.
    Please do add reputation where you see fit, it's nice to be nice and we all enjoy a pat on the back

    Please also mark your thread as solved once it has been.

  3. #3
    Registered User
    Join Date
    01-29-2015
    Location
    Wigan, England
    MS-Off Ver
    7
    Posts
    10

    Re: How to Count Periods of Activity

    That's excellent, thank you and works nicely. However.....

    I've since been sent the actual spreadsheet that the Macro needs to be applied to. It contains 810 rows and each row needs to be tallied individually. In addition, the rows contain EITHER 'M' or 'R'.

    Can the Macro be modified to take the extra parameters into account?

    Thanks in advance.

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

    Re: How to Count Periods of Activity

    Please try at M3
    =SUM(N(FREQUENCY(IF(A2:L2<>0,COLUMN(A2:L2)),IF(A2:L2="",COLUMN(A2:L2)))>0))
    Press Ctrl+Shift+Enter and drag down

  5. #5
    Registered User
    Join Date
    01-29-2015
    Location
    Wigan, England
    MS-Off Ver
    7
    Posts
    10

    Re: How to Count Periods of Activity

    That is perfect, thank you!!!
    Last edited by AliGW; 12-30-2019 at 07:38 AM. Reason: Please don't quote unnecessarily!

  6. #6
    Registered User
    Join Date
    01-29-2015
    Location
    Wigan, England
    MS-Off Ver
    7
    Posts
    10

    Re: How to Count Periods of Activity

    ------SOLVED-----

    Good morning everyone.

    I'm looking for a formula which is a variant of the answer to my original question please.

    This time, using the example in my first post, I need the formula to calculate how many times there are 2 consecutive M's - so the answer I'd be looking for is 1.

    Any help will be greatly appreciated.

    ----SOLVED----

    Just tweaked the original formula to {=SUM(N(FREQUENCY(IF(A1:G1<>0,COLUMN(A1:G1)),IF(A1:G1="",COLUMN(A1:G1)))=2))}
    Last edited by andyporter1975; 12-30-2019 at 07:47 AM. Reason: Solved

+ 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. excel, use pivot table to count activities by month and average by activity
    By dreamfalcon in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-25-2015, 11:38 AM
  2. Activity Time Tracker to capture activity selected from dropdown list
    By dillibabu in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-24-2013, 01:10 PM
  3. How to count the days when the periods overlap
    By Nathalie in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-07-2012, 09:46 AM
  4. A timer that will count time of various activity I do throughout the day
    By tridibp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2010, 12:52 PM
  5. Replies: 0
    Last Post: 10-14-2008, 03:09 PM
  6. Replies: 4
    Last Post: 03-06-2008, 09:11 AM
  7. [SOLVED] Count periods in a cell
    By Carim in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2006, 07:15 AM

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