+ Reply to Thread
Results 1 to 6 of 6

Count number of days according to a condition

  1. #1
    Forum Contributor
    Join Date
    10-26-2013
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2013
    Posts
    248

    Count number of days according to a condition

    Hi. I'm attaching my workbook. I'm trying to find the number of days between January 3rd 2000 and July 31 2015 where the column N (Face value) is not 0. B4 will always be January 3rd 2000 and the last data in column B (which will not be in the same row always) will always be July 31 2015. So if column N has non-zero numbers, the days will be 5688 (July 31 2015 minus January 3rd 2000). If some row in column N is 0 I don't want to include these days in my calculations. eg. N296 to n321 is 0 so I want to exclude the number of days from October 8 2004 to May 20 2005 from my calculations.


    Hope you understand what I'm trying to do!
    Thanks for any help!
    BRC question.xlsm

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Count number of days according to a condition

    With the start date in A1 and the end date in B1 this should give you a count of the days where the Closing Value is not 0. This is assuming that your have only one Opening value and one Closing value per day.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This could also be calculated with COUNTIFS
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by newdoverman; 10-05-2015 at 11:43 AM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Forum Contributor
    Join Date
    10-26-2013
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2013
    Posts
    248

    Re: Count number of days according to a condition

    Thank you for your answer but I don't understand what the formulas are doing and the result of 399 is not correct (I put the start date in A1 and the end date in B1). I'm trying to calculate the number of days from the start to the finish but without the date ranges for which the face value is 0. So starting from 5688 which is the maximum I have to subtract 224 (20/5/2005-8/10/2004), 21 (18/7/2005-27/06/2005), 77(21/10/2005-5/8/2005) and so on.

    Hope you understand what I'm trying to do!
    Thanks for any help!

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Count number of days according to a condition

    There are days between dates and there are dates. The list that you gave in your example has dates with gaps in between. Are you wanting to count the days covered by the date ranges or are you wanting to count the dates given? There is a huge difference. There are 5688 days between the first date and the last date but there are only 1046 dates listed.

    If you enter this in P5 and select P4 and P5 then fill to the bottom of your data then sum the days with 0 the answer is 1048 days with 0. This formula is just giving the number of days for the ranges
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If the start of the date range is counted and the end day is counted then this is the formula to enter in P5 and filled down. This will result in 1172 days for 0.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    See file (2)
    Attached Files Attached Files
    Last edited by newdoverman; 10-05-2015 at 04:50 PM.

  5. #5
    Forum Contributor
    Join Date
    10-26-2013
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2013
    Posts
    248

    Re: Count number of days according to a condition

    Thank you very much! The first formula was what I was looking for!

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Count number of days according to a condition

    Thank you for the feedback.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. count the number in if condition is met
    By chriskhan90 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-30-2015, 06:35 AM
  2. [SOLVED] Calculating number of days with condition
    By Ash248 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-13-2013, 08:14 PM
  3. [SOLVED] Counting number of days sick per condition
    By burnsie in forum Excel General
    Replies: 3
    Last Post: 03-08-2013, 05:42 AM
  4. 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
  5. Count unique days on condition that they are Mondays
    By Stijn@hccnet.nl in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2012, 12:11 PM
  6. Replies: 8
    Last Post: 07-13-2012, 09:02 AM
  7. Replies: 5
    Last Post: 04-01-2010, 03:07 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