+ Reply to Thread
Results 1 to 7 of 7

Different number of periods and days, calculated from a fixed period, with varying years.

  1. #1
    Registered User
    Join Date
    03-25-2023
    Location
    Copenhagen
    MS-Off Ver
    Microsoft? Excel? til Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 32-bit
    Posts
    11

    Different number of periods and days, calculated from a fixed period, with varying years.

    Hi Experts.

    I'm having trouble getting DATE. DIFFERENCE formulas, with the IF, AND, OR functions to work correctly in this case.

    Based on a table in a tab, with a fixed period of 12 months, only the year varies. I have given each cell the names in the yellow columns:

    Period.png

    And then I have two colons that contain different dates:

    Dates.png

    Based on these different dates, I would like the following columns to be calculated, according to the selected period/year:

    • Total number of days.
    • Number of total years (nearest).
    • Days BEFORE, the selected Period/Year.
    • Days IN the selected Period/Year.
    • Days AFTER the selected Period/Year.


    Control and difference are the easy part.

    Result.png

    I hope that someone in this good expert forum can help me, and therefore I say, thank you very much in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,324

    Re: Different number of periods and days, calculated from a fixed period, with varying yea

    Is this what you want?
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  3. #3
    Registered User
    Join Date
    03-25-2023
    Location
    Copenhagen
    MS-Off Ver
    Microsoft? Excel? til Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 32-bit
    Posts
    11

    Re: Different number of periods and days, calculated from a fixed period, with varying yea

    WAU!

    Thank you very much for your help. That's exactly what I was looking for – knowledge is king :-)

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,982

    Re: Different number of periods and days, calculated from a fixed period, with varying yea

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    03-25-2023
    Location
    Copenhagen
    MS-Off Ver
    Microsoft? Excel? til Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 32-bit
    Posts
    11

    Re: Different number of periods and days, calculated from a fixed period, with varying yea

    Hi Popipipo and Forum

    Sorry for my late return.

    On closer examination, it appears that column "F" does not make an actual calculation, as expected.

    Therefore, the calculation does not quite work, for example when there are shorter periods than, for example, a year.

    I am sorry if I have been unclear.

    But what I meant to show in column "F" (Days of the year) was:

    How many "real days" are there within the selected period (e.g., 02-04-22 - 01-04-2023 in cell "C1" and "D1")... So, for shorter periods than 1 year, in column "A" and "B", the result will not fit with 365 days, in column "F"

    The idea of this spreadsheet is to show the intersections of the days that lie - before, inside and after a given selected period.

    I hope this makes more sense, and I kindly look forward to seeing your or someone's response - thank you in advance.
    Attached Files Attached Files
    Last edited by carmad; 09-20-2023 at 12:49 PM.

  6. #6
    Registered User
    Join Date
    03-25-2023
    Location
    Copenhagen
    MS-Off Ver
    Microsoft? Excel? til Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 32-bit
    Posts
    11

    Re: Different number of periods and days, calculated from a fixed period, with varying yea

    Dear Alan Moderator and Forum

    Unfortunately, no one has replied to my latest and detailed comment in the post. And I also think that the solution to my task can be a "hard nut to crack".

    Therefore, to minimize errors in the use of this fine Forum, I would like to ask if it is possible to move this post to the commercial forum and pay for a solution? And also because I am now short of time.

    Ps. It's only the second time I've posted anything in here, so unfortunately, I'm not as knowledgeable as a user in here yet...

    I hope for a friendly answer – thank you very much in advance.
    Last edited by carmad; 09-21-2023 at 08:32 AM.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,700

    Re: Different number of periods and days, calculated from a fixed period, with varying yea

    I don't see where this was posted in commercial services so I will propose a solution here.
    1. For column E: =MAX(0,$C$1-A3)
    2. For column F: =IF(A3="","",DAYS(MIN(B3,D$1),MAX(A3,C$1))+IF(B3>D$1,1,0))
    3. For column G: =MAX(0,B3-$D$1-1)
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. Amortisation schedule with varying periods and varying interest rates
    By markvdhouten in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-22-2021, 12:50 AM
  2. From number of days to Years, months and days DATEDIFF madness!!
    By zozew in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 01-13-2021, 10:56 PM
  3. Calculate number of years based on financial period range
    By vijanand1279 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-21-2018, 10:16 AM
  4. formula to add a varying suffix to a fixed number
    By coyy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-13-2018, 11:52 AM
  5. [SOLVED] Total units made by week number with varying manufacturing periods
    By BRISBANEBOB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2016, 06:49 PM
  6. Replies: 0
    Last Post: 06-11-2015, 03:12 AM
  7. Pivot - calculated % based on a fixed number - #I/T
    By BJDK in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-31-2013, 03:00 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