02-23-2020 03:38 PM
02-23-2020 03:38 PM
How do you group dates that fall within specific date ranges? Is it by formula or by grouping by month, but the grouping won't work if you want an odd date range like from the 9th of one month to the 10th of the next month.
02-23-2020 10:52 PM
There are many ways to handle your query, If you have single range of date, then I would recommend you using IF function (You can add multiple criteria in IF function, but formula will become too complex). I'm attaching Excel Workbook with few examples with IF , VLOOKUP & XLOOKUP.
Hope this might be helpful.
Regards, Faraz Shaikh | MCT, MIE, MOS Master, Excel Expert | www.ExcelExciting.com
02-24-2020 01:03 AM - edited 02-24-2020 01:04 AM
@Faraz Shaikh Sorry, I don't think I was very clear in my question.
I have a list of employees with their work dates in a given year. I want to insert a formula that indicates which period they fall in but it has to be a date from 15th to 14th of following month. So if the date is 01/05/2020 it should fall in the period 12/15/2019-01/14/2020. What formula would do this?
Employee Work Date PERIOD
John 01/05/2020 12/15/2019-01/14/2020
John 01/15/2020 01/15/2020-02/14/2020
John 02/05/2020 01/15/2020-02/14/2020
John 03/06/2020 02/15/2020-03/14/2020
02-24-2020 02:09 AM
Create a help table with border-dates and Group names. Something like:
01/01/2020 - 01/15/2020
01/15/2020 - 02/01/2020
02/01/2020 - 03/01/2020
03/01/2020 - 04/01/2020
04/01/2020 - 05/01/2020
05/01/2020 - 06/01/2020
06/01/2020 - 07/01/2020
07/01/2020 - 08/01/2020
08/01/2020 - 09/01/2020
09/01/2020 - 10/01/2020
10/01/2020 - 11/01/2020
11/01/2020 - 12/01/2020
Then you can use Match/index with match_type 1 or vlookup with “approximate match”=true.
If your support-table is in H1:I13 something like this should word:
(Quick and Dirty translation. Play around)
02-24-2020 02:17 AM - edited 02-24-2020 02:18 AM
@MMH11 Alternatively, use one of the solutions in the attached workbook. The first one determines both the start and the end of the period, based on the start day (15 in your case). It uses the fairly neat EOMONTH function. The second option combines start and end of the period into one text string.
Cell B1 contains the start day of your period and I gave it the name "from".
02-24-2020 02:19 AM - edited 02-24-2020 02:22 AM
<ed>sorry. i missed Rinys last answere. This is probably a duplicate.</ed>
Generic formula. Same reservation as before. It’s an untested translation.
02-24-2020 11:05 AM
@MMH11 Well, I guess Excel uses standard periods such as calendar weeks, months, quarters and years. And then you can group by x number of days (like 28 days = 4 weeks). Grouping from the 15th of one month till the 14th of the next may be 30 days one month, 31 days another and sometimes 28 or 29 days. So, thats not a fixed number of days either. But why Excel can't do it by default, I can't tell. Perhaps, that's why they came up with EOMONTH.