How To Calculate Date From Day Number In Excel - date

I have a small application built in Excel. It is a time management workbook where I record the hours worked on projects for each month.
In one column I have the possible days
e.g.
DAY 1
DAY 2
DAY 3
DAY 4
....
DAY 22
for the possible 22 workdays in a month. I have a worksheet for each month.
For each of those day numbers how would I calculate the date for that day in the Month?

You can try WORKDAY - Does the following helps?

Related

SSRS - How to show rolling 6 months where the start date is always a Saturday?

I need help on calculating my start date for my report date parameters.
The end date will always be the last Sunday, here: =DateAdd("d", 1 - WeekDay(Today(), 1), Today())
What I need help with is how to write a formula to go back 6 months from today and pick the 1st Saturday in that range..
Thanks in advance.
Assuming your start day is a Sunday then you can use this...
=DATEADD(
DateInterval.Day,
7 - WEEKEDAY( DATEADD(DateInterval.Month,-6,Today()), FirstDayOfWeek.Sunday),
DATEADD(DateInterval.Month,-6,Today())
)
This works as follows
WEEKEDAY( DATEADD(DateInterval.Month,-6,Today()), FirstDayOfWeek.Sunday)
Takes today's date, subtracts 6 months and then finds out what daynumber that is. Running that today (2018-11-08) gives use (2018-05-10) which is a Thursday, this is day number 5
Saturdays are day number 7 (if your first day of week is a Sunday). As there can be no higher number than 7 we can do a simple subtraction of 7 minus the day number we landed on (from above) which gives us a required adjustment of 2 days.
Finally the outer DATEADD function simply says add our calculated 2 days to the date 6 months ago.
Hope that makes sense!?
If the first day of the week is not a Sunday for you then you may have to do some Mod% calc on the second argument to calculate the correct number of days to adjust by.

Get same day of week last year Excel formula

Would it be possible to get same day of week last year using Excel? please below example:
Input: Monday 9 Nov 2015 | Output: 10 Nov 2014
Thanks
Simply subtract 52 full weeks with 7 days = 364 days. So if the date is in A1, the formula =A1-364 will get the date exactly 52 weeks before, which is the same day of week in the year before.
To show that it works even for leap years, try the following:
You see the formula date - 364 (=A2-364, =A3-364, ...) always gets the same day of week a year before. That is because it gets the day minus 52 full weeks (52 * 7 days) before. In leap years it gets a different day but the same day of week.
Try this:
=DATE(YEAR(A1)-1,MONTH(A1),DAY(A1))+WEEKDAY(A1)-WEEKDAY(DATE(YEAR(A1)-1,MONTH(A1),DAY(A1)))
It returns the closest date within a week. A1 is the cell with this year's date.

DB2 creating year and Quarter and week from timestamp

I separated the time stamp to year and quarter and week using this query
select EVENTTIMESTAMP, Year (EVENTTIMESTAMP), QUARTER (EVENTTIMESTAMP), Week (EVENTTIMESTAMP) from KAP.COGNOS
there only two things i was trying to enhance in it
1- the weeks returns a number between 1-54, I want it to be return 13 or 14 weeks as weeks of Quarters.
2- to add word before the number of Quarter 'Quarter' and then it's number, and so to the weeks to show word 'Week' then the number
Many Thanks!!

DB2 separate number of weeks per quarter from timestamp

I'm trying to separate weeks from timestamp per quarter so it should be between 1-13 week per quarter so I used function week() but it takes between 1-52 week as whole year so I made it to be divided by function of quarter like below
select Week (EVENTTIMESTAMP) / QUARTER (EVENTTIMESTAMP) from KAP
The thing here that results aren't accurate; for example it shows:
time stamp 2014-07-06 12:13:03.018
week number 9
which isn't correct because July is first month in Q3 and it's in the 6 days so it should be 1 week from Q3 not 9.
Any suggestion where it go wrong?
You want something like WEEK modulo 13 to get week number within a quarter. You will have to tinker with 'modulo 13 yields 0..12' by adding or subtracting one at appropriate points.
Some minimal Google searching using 'ibm db2 sql modulo' yields DB2 MOD function:
The MOD function divides the first argument by the second argument and returns the remainder.
Hence MOD(WEEK(...), 13), except you probably need MOD(WEEK(...)-1, 13) + 1, as intimated already.
You may need to watch for what the WEEK() function does at year ends:
The WEEK function returns an integer in the range of 1 to 54 that represents the week of the year. The week starts with Sunday, and January 1 is always in the first week.
I'm curious about how they can come up with week 54. I suppose it requires 1st January to be a Saturday (so 2nd January is the start of week 2) of a leap year, as in 2000 and 2028. Note that week 53 and (occasionally) week 54 will show up as weeks 1 and 2 of Q5 unless you do something. Also, Saturday 2000-03-25 would be the end of Q1 and Sunday 2000-03-26 would be the start of Q2 under the regime imposed by the WEEK() function and a simple MOD(WEEK(...), 13) calculation. You're likely to have to tune this to meet your real requirements.
There's also the WEEK_ISO() function:
The WEEK_ISO function returns an integer in the range of 1 to 53 that represents the week of the year. The week starts with Monday and includes seven days. Week 1 is the first week of the year that contains a Thursday, which is equivalent to the first week that contains January 4.
Note that under the ISO scheme, the 3rd of January can be in week 52 or 53 of the previous year, and the 29th of December can be in week 1 of the next year. Curiously, there doesn't seem to be a YEAR_ISO() function to resolve such ambiguities.
In a data warehouse, the proper solution to this is to create a time dimension that contains static mappings for days/weeks/months/quarters/years. This provides the ability to define these based on your business' fiscal calendar (if it is not following on the calendar year).
See: http://www.kimballgroup.com/1997/07/10/its-time-for-time/ for more information.

How to get the Date difference between two dates in postgresql? excluding weekends and only office hours

How to get the Date difference between two dates in postgresql? ( Excluding weekends Saturday and Sunday, and out of office hours). It should calculate the time only on weekdays during office hours( 9 - 6). My requirement is to calculate the time between 2 date columns in hours. Thanks in advance