+ Reply to Thread
Results 1 to 9 of 9

Calculate number of x values between two dates

  1. #1
    Registered User
    Join Date
    04-11-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    2007
    Posts
    4

    Calculate number of x values between two dates

    I am given several start and end dates, with an x or y value attached. I need to count x values based on set weeks. How many x's will I need the week of Jan 8? and so on...
    Attached Files Attached Files
    Last edited by RuthN; 04-11-2017 at 11:27 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: Calculate number of x values between two dates

    Welcome to the forum!

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,320

    Re: Calculate number of x values between two dates

    Should have waited until I had the file ... and re-read requirement!!!
    Last edited by JohnTopley; 04-12-2017 at 02:36 AM.

  4. #4
    Registered User
    Join Date
    04-11-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    2007
    Posts
    4

    Re: Calculate number of x values between two dates

    :/ this returned a 0 value for all rows...thanks anyway

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,320

    Re: Calculate number of x values between two dates

    ... that is (in part) because the dates are not Excel date format and my formula was wrong!.
    Last edited by JohnTopley; 04-11-2017 at 04:17 PM.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,407

    Re: Calculate number of x values between two dates

    After converting the text "dates" to numbers this formula doesn't return the results you expect. I have tried several different interpretations and WEEKNUMs starting days and can not duplicate what you show.

    =SUMPRODUCT(--(WEEKNUM($F2,1)>=WEEKNUM(--$A$2:$A$19,1)),--(WEEKNUM($F2,1)<=WEEKNUM(--$B$2:$B$19,1)),--($C$2:$C$19="x"))

    What am I missing?
    Dave

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,320

    Re: Calculate number of x values between two dates

    @Dave,
    I am sure your results are a correct interpretation but as an aside, I am wondering how meaningful the final table is:

    How many x's will I need the week of Jan 8? and so on...
    Take 12 Jan-1 Feb: do we need "x" for each week that falls within this period? the whole period? and what does the result of 3 for week 8 Jan mean?

    Perhaps more coffee is required ......!

  8. #8
    Registered User
    Join Date
    04-11-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    2007
    Posts
    4

    Re: Calculate number of x values between two dates

    January 12 falls within the week of January 8th...therefore I know the week of Jan 8 I will require an x. In real life, the "x" are employees and the start and end dates are assignment dates. I am trying to manage resources on a weekly basis, based on start and end dates of assignments.

  9. #9
    Registered User
    Join Date
    04-11-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    2007
    Posts
    4

    Re: Calculate number of x values between two dates

    My "desired solution" was incorrect. Your formula seems to work! Thank you

+ 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 number of days between 2 dates
    By DTYS in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-28-2017, 06:01 AM
  2. Calculate number of days between 2 dates & then assign a number based on the answer
    By MrHappyGoLucky12 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-27-2014, 09:20 PM
  3. Calculate number of days between dates
    By karl8695 in forum Excel General
    Replies: 1
    Last Post: 05-08-2012, 12:54 PM
  4. Calculate the number of Months between dates
    By Johndrew in forum Excel General
    Replies: 2
    Last Post: 09-03-2010, 02:18 AM
  5. [SOLVED] calculate number of days btw dates
    By Nelson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2006, 09:02 PM
  6. [SOLVED] Calculate number of months between 2 dates
    By john liem in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 06-01-2005, 10:05 AM
  7. [SOLVED] HOW TO CALCULATE NUMBER OF WEEKS BETWEEN TWO GIVEN DATES(MAY BE .
    By WARRENCHERYL in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2005, 05:06 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