+ Reply to Thread
Results 1 to 6 of 6

Count number of active days for a specific ID

  1. #1
    Registered User
    Join Date
    01-09-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    27

    Count number of active days for a specific ID

    Hi,

    I need some help I'm trying to identify the total number of active days for a particular "Event ID" (column H) against the "Date" column (column A) and populate this in the "Number of nights active?" column (Column G).

    As a guide to what I am looking for, I have manually populated column G (image below and attachment included) with what results I want inputted but with the use of the correct formula, which I hope you guys can help me with please

    For example, with Event ID 211966, the number of nights active is "2" this is because this event ID is active between the dates 03/10/2018 - 05/10/2018 for 2 nights (3rd and 4th).

    I also expect certain rows the number of nights active column to remain as “0” if all the dates for a particular Event ID is the same. For example, with Event ID “211819”, all the events that occurred are on the same date (01/10/2018), so it should not count anything and return a “0” value”, as I only want the formula to do a count for when the dates for given Event ID is a different date (each night = +1 count)

    The same also occurs with Event ID “211825”, where I have 3 different dates, 01/10/2018, 02/10/2018 and 03/10/2018, so the expected result is “2”, as its 2 nights between the 3 dates.

    I would really appreciate it if someone could help me with this please? What formula would be best to use? Would it be a MIN/MAX formula or something else totally different?

    I am willing to clarify anything if what I have said does not make sense!


    Capture4.PNG
    Attached Files Attached Files

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count number of active days for a specific ID

    Try this in G2:

    =LOOKUP(2,1/([Event ID]=H2),[Date])-INDEX([Date],MATCH(H2,[Event ID],0))

  3. #3
    Registered User
    Join Date
    01-09-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    27

    Re: Count number of active days for a specific ID

    Quote Originally Posted by 63falcondude View Post
    Try this in G2:

    =LOOKUP(2,1/([Event ID]=H2),[Date])-INDEX([Date],MATCH(H2,[Event ID],0))
    Thank you! It works!

    However, if possible, are you kindly able to explain what your formula is doing please? I would appreciate your help
    Last edited by Alfie092; 01-16-2020 at 08:05 PM.

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count number of active days for a specific ID

    Sure.

    =LOOKUP(2,1/([Event ID]=H2),[Date])
    returns the last date where [Event ID]=H2

    =INDEX([Date],MATCH(H2,[Event ID],0))
    returns the first date where [Event ID]=H2

    Subtracting the first date from the last date, gives us the number of days.

  5. #5
    Registered User
    Join Date
    01-09-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    27

    Re: Count number of active days for a specific ID

    Quote Originally Posted by 63falcondude View Post
    Sure.

    =LOOKUP(2,1/([Event ID]=H2),[Date])
    returns the last date where [Event ID]=H2

    =INDEX([Date],MATCH(H2,[Event ID],0))
    returns the first date where [Event ID]=H2

    Subtracting the first date from the last date, gives us the number of days.
    Thank you very much for that!

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count number of active days for a specific ID

    Happy to help.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as 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. Replies: 1
    Last Post: 11-05-2019, 12:38 PM
  2. [SOLVED] Number of days active per year
    By Mrkumbo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2018, 04:56 AM
  3. Replies: 16
    Last Post: 08-22-2017, 11:20 AM
  4. [SOLVED] Collecting a total value of a specific from specific hours and number of days
    By jexzard in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2013, 09:20 AM
  5. [SOLVED] Count the days remaining IF the status is active
    By marqz in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-11-2013, 09:45 PM
  6. Count Distinct Active Days
    By bongielondy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-04-2013, 07:36 AM
  7. Help on count the number of days in between dates and then average number of days
    By Barbara Excel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2013, 12:13 PM

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