Forum Discussion
Formula including future specific days/dates
- Oct 05, 2021
This one was fun. Had to do some playing around to get all the answers.
Let's assume the last entered date is in cell C35.
The formula to determine the next Friday is:
=C35+CHOOSE(WEEKDAY(C35),5,4,3,2,1,7,6)
The formula to determine the next end of month is:
=IF(C35=EOMONTH(C35,0),EOMONTH(C35,1),EOMONTH(C35,0))
The formula to determine the next 15th of a month is
=IF(DAY(C35)<15,
DATE(YEAR(C35),MONTH(C35),15),
DATE(YEAR(C35),MONTH(C35)+1,15))
(and yes, those last two work across year boundaries as well)
Let me know if you want the formulas explained. You might have fun parsing them yourself, but if you get stumped, I'd be happy to explain how they work.
Cell C2 is obviously key in that set of conditionals. So some questions:
- What is in cell C2?
- How does it get entered or calculated?
- What would be the values that would lead to those conclusions that are hanging you up?
Is it possible for you to post a copy of the actual spreadsheet, or at least a mockup of the dashboard as it currently exists in development. Don't include actual confidential or proprietary data, of course, but the more you could share of the actual (or a mockup), the more we could give a recommendation that relates to your actual situation.
- Tolley123Sep 30, 2021Copper ContributorThank you Mathetes for your interest in helping.
Apologies for not previously providing sufficient clarity. Whilst my previous note may still be useful for general context I suggest it is set aside, and let me try and clarify the essential elements:
ļ whatever day a user updates a KPI result the date of the update is input to a data collection worksheet.
ļ There is a need to develop (three?) formulae that calculate from the update date:
(i) the number of days to the following Friday;
(ii) the number of days to the next 15th of a month; and,
(iii) the number of days to the next end of a month.
With the above formulae providing correct quantitive results I believe I will then be able to develop the corresponding formulae that will report the required narrative statements.
Any assistance you can provide in developing the required formulae at (i) to (iii) above would be most appreciated. Thank you.- mathetesOct 01, 2021Gold Contributor
I'm on vacation at present, only sporadically checking these boards. These are intriguing formulas you're seeking and I"m looking forward to working on them, confident I'll be able to resolve (although it's going to take some playing around)....but it could easily be a week before I can devote the time. In the meantime, and to help make sure that if somebody else jumps in that we're addressing exactly what you need, let me ask just a couple more clarifying/confirming questions.
Let's assume the date of the last entry is in cell A1, for the purposes of discussion:
(i) the number of days to the following Friday;
If the date in A1 is that of a Thursday, do you mean the very next day, or the Friday of the following week?
(ii) the number of days to the next 15th of a month;
If the date in A1 is the 14th, do you mean the very next day, or the 15th of the following month?
(iii) the number of days to the next end of a month.
If the date in A1 is the 27th of the month, do you mean the end of the same month, or the end of the following month?
- Tolley123Oct 03, 2021Copper Contributor
Hi Mathetes, thanks for your note.
In each case it is the very next Friday/15th/month-end, so if the update was done on Wednesday 8-Sept, the three formulae would report 2, 7 and 22 respectively.