+ Reply to Thread
Results 1 to 2 of 2

split date range into date ranges of corresponding months

  1. #1
    Registered User
    Join Date
    01-03-2016
    Location
    Serbia
    MS-Off Ver
    2007
    Posts
    25

    Question split date range into date ranges of corresponding months

    Hy,

    I need FROM 4 parts of vacation - CAN BE LESS (8 columns) in a sheet
    to extract date ranges for each month and match it with a name
    ex: vacation
    20.10.2017 - 12.11.2017 needs to be splitted (or not if it\s in only one month) into 20-31.10 and 01-12.11

    I have calculated vacation for people based on entered number of vacation days and starting date

    =IFERROR(WORKDAY(WORKDAY(EDATE($I4;0);-1);$H4+IF(AND(IF(AND(WEEKDAY($D4)<>1;WEEKDAY($D4)<>7);$D4;0)>=$I4;IF(AND(WEEKDAY($D4)<>1;WEEKDAY($D4)<>7);$D4;0)<=$J4);1;0)+IF(AND(IF(AND(WEEKDAY(DATE(YEAR($D4)+1;MONTH($D4);DAY($D4)))<>1;WEEKDAY(DATE(YEAR($D4)+1;MONTH($D4);DAY($D4)))<>7);(DATE(YEAR($D4)+1;MONTH($D4);DAY($D4)));0)>=$I4;IF(AND(WEEKDAY(DATE(YEAR($D4)+1;MONTH($D4);DAY($D4)))<>1;WEEKDAY(DATE(YEAR($D4)+1;MONTH($D4);DAY($D4)))<>7);(DATE(YEAR($D4)+1;MONTH($D4);DAY($D4)));0)<=$J4);1;0);PRAZNICI!$A$2:$A$20);"-")

    anyone can use whole vacation in four parts (or less), so i have number of vacation days per part, beggining and end of vacation.

    I'm calculating count of people on a vacation like so

    =SUMPRODUCT(--(SVI!$I$4:$I$295<=A$2);--(SVI!$K$4:$K$295>=A$2))+SUMPRODUCT(--(SVI!$N$4:$N$295<=A$2);--(SVI!$P$4:$P$295>=A$2))+SUMPRODUCT(--(SVI!$S$4:$S$295<=A$2);--(SVI!$U$4:$U$295>=A$2))+SUMPRODUCT(--(SVI!$X$4:$X$295<=A$2);--(SVI!$Z$4:$Z$295>=A$2))

    i have a pattern for print and i need to split vacation by months (from first of the month or to last of a month) and match it with names of people

    i was trying somenthing like this (in example file):
    temporarily
    =A1
    =IF(MONTH($B1)=MONTH($A1);B1;EOMONTH($A1;0))
    =IF(MONTH($B1)=MONTH($A1);"";EOMONTH($A1;0)+1)
    =IF(MONTH($B1)=MONTH($A1);"";$B1)

    and then to match it with a month
    =IF(MONTH(D1)=MONTH($K$10);D1;"")
    =IF(MONTH(F1)=MONTH($M$10);F1;"")


    Does anyone has a better solution?
    Thanks
    Attached Files Attached Files

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

    Re: split date range into date ranges of corresponding months

    The sample file attached only shows data relevant to the last part of your query, so it's impossible to answer. This is probably why you have had no help offered so far.
    Ali


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


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

+ 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. Split date ranges into single rows per date
    By HowieB in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 05-01-2021, 02:34 AM
  2. Count overlapping months from date ranges
    By jasonnj1978pwest in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2017, 04:53 PM
  3. How to split date range and volume into months
    By okok15266 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2016, 11:13 AM
  4. Split Revenues Between Date Ranges
    By tw92 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2016, 06:34 AM
  5. Split the equal amount acoss months based on start and end date
    By Ktahilramani in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-07-2014, 11:18 PM
  6. Replies: 0
    Last Post: 03-30-2012, 01:56 PM
  7. Replies: 2
    Last Post: 01-04-2012, 09:15 AM

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