+ Reply to Thread
Results 1 to 6 of 6

COUNTIFS between 2 dates - how to calculate for blank dates

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    COUNTIFS between 2 dates - how to calculate for blank dates

    My COUNTIFS formula is:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...where EmpRange and DateRange are named ranges, $A$2:$A$100 (for names, e.g., "Bob" etc.) and $B$2:$B$100 (which contains various dates) ...and DateFrom and DateTo are named cells. When I have an actual date in the named date cells, for example, 9/1/14 for DateFrom, and 9/12/14 for DateTo (USA short format) - the formula works great and returns all the "Bobs" between the specified dates.

    But I need the option of leaving either or both of the named date cells BLANK, and for my formula to return the following:

    IF DateFrom is blank, but there is a date in DateTo, then calculate the criteria for ALL the dates with "Bill" (following this example) on or before the "To" date (no begin date).

    Conversely, if DateTo is BLANK, but DateFrom has a date value, then run the formula calculating from the begin date specified, but no end date (technically, this could be a date in the future, but as I don't think I should have any when I put the workbook in use, so I could use until TODAY if it made a difference)... finally, if both DateFrom and DateTo are blank, return all "Bills" - basically ignoring the dates.

    Any suggestions?

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up Re: COUNTIFS between 2 dates - how to calculate for blank dates

    Actually...
    The formula you made should do the job as you said..
    if it is not, then provide the workbook...
    let us give it a try..
    Last edited by Vikas_Gautam; 09-12-2014 at 11:20 PM.
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  3. #3
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: COUNTIFS between 2 dates - how to calculate for blank dates

    Sample1.xlsx

    Named Ranges are in Sheet1, the rest in Sheet2.

    The formula in question is in Sheet2!E5. With 2 dates in E2 & E3, it works fine. Delete 1 or both dates and it returns "0."

    Thanks for looking.

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Cool Re: COUNTIFS between 2 dates - how to calculate for blank dates

    I guess I have cracked it..
    Try this as Array forumla.. ( Press CTRL + SHIFT + ENTER to enter it..)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Check the attached file..
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: COUNTIFS between 2 dates - how to calculate for blank dates

    Awesome.

    Question on the array formula (I've worked with them but not extensively): once it is entered (with CTRL+SHIFT+ENTER) - can the formula be saved to the file and emailed without the person opening it having to activate it? I guess it can, since I downloaded and opened your sheet with it.

    Thanks!

  6. #6
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: COUNTIFS between 2 dates - how to calculate for blank dates

    Yeah..
    you can..
    No reactivation is required...

    and thanks for reputation point..

+ 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. Calculate differnce between 2 dates, but if 1 date cell is blank leave cell blank
    By Vicious00013 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-11-2014, 11:31 PM
  2. [SOLVED] Calculate days between 2 dates and returning a blank cell if there is missing data
    By j_dinh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-14-2013, 01:53 AM
  3. Replies: 0
    Last Post: 02-01-2013, 05:10 PM
  4. Replies: 1
    Last Post: 11-01-2012, 03:41 PM
  5. Replies: 3
    Last Post: 07-19-2010, 01:02 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