Excel display nth day of current month - excel

I have a list of recurring bills. Some are on the 1st of every month, and some are on the 15th or 16th etc. What I want to be able to do is display this day within the current month. So if it is February, and the bill recurs on the 9th every month, my cell will show 02/09/12, and if it was march, it would show 03/09/12. Is there a formula or macro to accomplish this?

Found it to be: =DATE(YEAR(TODAY()),MONTH(TODAY()),18)

If you have the number 9 in A1 this formula will show the 9th of the current month (whether that be in the future or the past)
=TODAY()-DAY(TODAY())+A1

edate(start-date),1)
ie edate(B3,1)
b3= 1/5/13
Result = 5th of 1 month later - 2/5/13
3 for quarterly, 12 for annual

Related

Excel Date Calculation with Rounding

I am currently working on a report where i want to find out the months between 2 dates. I currently have this
=(DATEDIF(U224,V224,"m")+1)
However i want it to add another element where if the initial date is on or before the 15th of the month it will round down if it is 16th and after it will round up the month.
For example first date is 13th February and second date is 31st June. It will bring back 5 months. However if the first date is 20th February it will bring back 4 months.
Thanks in advance
It sounds like you are saying:
=IF(DAY(U224)<16,DATEDIF(U224,V224,"m"),DATEDIF(U224,V224,"m")+1)

Excel formula, IF certain day of week then add "x" number of days

I'm having trouble figuring out how to write a formula for the following scenario. I need to calculate date based on another column but need to add days based on day of the week of original column.
If day of week equals 'Mon/Wed/Fri/Sat' then add 5 days.
If day of week equals 'Tue' then add 6 days.
If day of week equals 'Thur" then add 4 days.
For example,
Column A Column B
3/11/17 (Show date based on above scenario)
3/13/17
3/18/17
Use Choose:
=A1+CHOOSE(WEEKDAY(A1,2),5,6,5,4,5,5,0)
So the Weekday(A1,2) converts the weekday to its position in the week starting with Monday being 1 and Sunday being 7.
The numbers are the number of days to add per day.
It then adds the chosen day to the date.

Calculate the first week of year which starts from first Sunday of every Feb

I have an issue here. I want to calculate the week nummber of first sunday of business year. Where I work their calendar starts on February 1st. To calculate i have a column A2 in excel which has the date in mm/dd/yyyy format. I want to generate the corresponding fiscal week for the column.
example of my result set:
for 2/1/15 the week of year number should be 1
For 2/7/16 the week number of year should be 1
I tried the below formula, but its starting the week from the first day of the fiscal year and not the first sunday of the year.
=INT((A1-WEEKDAY(E9165)-DATE(YEAR(A1+7-WEEKDAY(A1))-(MONTH(A1)<2),2,1))/7)+2
Please help...
-Sandra
Assuming that your work years always start on the first sunday after February 1st:
=IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))
We first determine the week number of the date starting from the first Sunday of February. To do this I have used WEEKNUM()-WEEKNUM(02/01/SAMEYEAR) taking 1 day from the date to force week 1 as Excel begins counting from week 0 by default. Using IF() we state that if the outcome is 0 or less then add the result to 52, which will give us the correct result for dates in January as they produce negative values.
Edit - Very long formula but gives you the week of the quarter in Q1 W1 format:
=SUBSTITUTE(CONCATENATE("Q",INT(IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))/13)+(IF(INT(IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))-INT((IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))/13))*13)=0,0,1))," W",INT(IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))-INT((IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))/13))*13)),"W0","W1")
Apologies for the length, I tried multiple methods to try to find a neater solution, but this was all that I could get to work. It would be a lot neater if there were multiple columns used.
Use this formula:
=IF(A1>=IF(WEEKDAY(DATE(YEAR(A1),2,1),1)=1,DATE(YEAR(A1),2,1),DATE(YEAR(A1),2,7-WEEKDAY(DATE(YEAR(A1),2,1),1)+2)),ROUNDUP((A1-IF(WEEKDAY(DATE(YEAR(A1),2,1),1)=1,DATE(YEAR(A1),2,1),DATE(YEAR(A1),2,7-WEEKDAY(DATE(YEAR(A1),2,1),1)+2))+1)/7,0),ROUNDUP((A1-IF(WEEKDAY(DATE(YEAR(A1),2,1),1)=1,DATE(YEAR(A1)-1,2,1),DATE(YEAR(A1)-1,2,7-WEEKDAY(DATE(YEAR(A1)-1,2,1),1)+2))+1)/7,0))
Way late to the party but was looking for the answer and found this thread. Ended up play around with the function myself and it's much easier to just deduct the dates; =WEEKNUM("date"- days you wish to offset)
Ex; If cell A1 holds my date, 2/1/2021 I wish to convert; =WEEKNUM(A1-31) result "1".

Formula to get the last date(30th or 31st) of the added month to a date in SharePoint calculated column

I have a column name DateOfJoining and another column EndProbation. When Date is filled in DateOfJoining Field (Eg: 5th June 2016) the last date of the 6th month added should be displayed in the EndProbation(Calculated column) column.(When 6 month is added it will be 5thDec but it should be 31st December). Please help me out to write Formula in calculated column.
Thanks in Advance.
If you want to display the last day of the month, you can use a formula like this:
=DATE(YEAR([column]),MONTH([column])+1,0)
There are three parameters in that DATE() function:
The first one is the year. YEAR([column]) says to show the year from the [column] column (which should be a date field)
The second one is the month. MONTH([column])+1 says show me the month after the month from [column]
The third one is the date. 0 says show me the day before the first day of the month (the 0th day of the month instead of the 1st day of the month).
If you need to show the last day of the month six months from now, that'll be pretty similar:
=DATE(YEAR(A1),MONTH(A1)+7,0)
The only difference is that you increase the month parameter by 7 instead of by 1.

Excel function to determine the last Friday in a month

I'm looking for an Excel function to return the last Friday in a month for a given date.
ie: Any date in the month as input will give the date of the last Friday as output.
14-July-09 should give 31-July-09
7-March-05 should give 35-March-09
Building on #Toomas answer above, I had to make some amendments for Excel 2007, but came up with the following:
=EOMONTH(A1,0)-MOD(WEEKDAY(EOMONTH(A1,0))+1,7)
Which is assuming that the WEEKDAY returned for Friday is 6 and then applying a shifted MOD 7 to achieve the correct day.
Try this formula:
=IF(WEEKDAY(EOMONTH(A5;0);16)=7;EOMONTH(A5;0);EOMONTH(A5;0)-WEEKDAY(EOMONTH(A5;0);16))
Enter to A5 date value of which you are looking for the last Friday in a month.
The following formula achives this for a date in cell A1:
=DATE(YEAR(A1),MONTH(A1)+1,0)+MOD(-WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,0),2)-2,-7)
I came here looking for the formula to get the most recent Friday in the past which turned out to be =TODAY()-WEEKDAY(TODAY())-1
In case anyone needs to do this for next year (or future years):
=EOMONTH(DATE(YEAR(TODAY())+1,MONTH(TODAY()),1),0)-MOD(WEEKDAY(EOMONTH(DATE(YEAR(TODAY())+1,MONTH(TODAY()),1),0))+1,7)
Here's one that will show the last Friday of the current month.
And if the date is in the past it will show you next month's last Friday.
And if it's December right now, it'll show you next year's January's Friday.
=IF(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0)+MOD(-WEEKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0),2)-2,-7)>=TODAY(), DATE(IF(MONTH(TODAY())+1>12,YEAR(TODAY()+1),YEAR(TODAY())),MONTH(TODAY())+1,0)+MOD(-WEEKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0),2)-2,-7), DATE(IF(MONTH(TODAY())=12,YEAR(TODAY())+1,YEAR(TODAY())),MONTH(IF(MONTH(TODAY())=12,1,MONTH(TODAY())))+1,0)+MOD(-WEEKDAY(DATE(IF(MONTH(TODAY())=12,YEAR(TODAY())+1,YEAR(TODAY())),MONTH(IF(MONTH(TODAY())=12,1,MONTH(TODAY())))+1,0),2)-2,-7))
You can try
=DATE(YEAR(A1),MONTH(A1)+1,1)-1+CHOOSE(WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,1)-1),-2,-3,-4,-5,-6,0,-1)
to find the last friday of the month. Assumes A1 has the date.
Hey the formatting is outdated so ill show what I came up with:
=EOMONTH(A1;A2)-(WEEKDAY(EOMONTH(A1;A2);15)-1)
[A1] is an interval of months later, from [A2] the stating date, that the result date should be.
We have some equipment that need maintenance last Friday of the month, an number of months since last Maintenace.
EOMONTH(A1;A2): we find the date, of the last day, of target month.
WEEKDAY([Date];15): assign a number for day of the week.
[15] makes Friday the value 1 and Thursday the value 7.
so if the last day of the month is Friday, the calculation would be:
[Date]-(1-1) = [Date] therefor the date won't change.
[Date] in my original code example, is the last day of the target month: [A2] date + [A1] number of months later.
if the last day is Wednesday, we want it to subtract 5 days: [Date]-(6-1) = [Date]-5
As a sidenote:
=WORKDAY(A2+1;-1;[hollydays])
will round a date back to the earlier Workday if it lands in a weekend or holyday
[holyday] can be an area of cells with predefined dates to skip eg: [$C$1:$C$20].
$ is so the area won't change when you extend the function to other cells.
if you don't care about holydays use =WORKDAY(A2+1;-1)
Awesome! Basically, like trying to find the first or second Monday of the month,
=DATE(TheYear,5,1)+CHOOSE(WEEKDAY(DATE(TheYear,5,1)),1,0,6,5,4,3,2)
which returns the first Monday of the month, in this case May
but to find the last weekday of the month, in the formula, you start with the next month and subtract
=DATE(TheYear,6,1)-1+CHOOSE(WEEKDAY(DATE(TheYear,6,1)),-6,-5,-4,-3,-2,-1,0)
which returns the last Monday of May
I have a cell that I named TheYear, in which I enter the year I'm working with, but you can point to whatever cell you have the year you want (e.g. A1).
I don't know why the pointers to the days of the week are in reverse order but to find the day (e.g. Tuesday instead of Monday), change the order of those numbers but they have to stay in order. For example, 4th Thursday of November:
=DATE(TheYear,11,1)+21+CHOOSE(WEEKDAY(DATE(TheYear,11,1)),4,3,2,1,0,6,5)
=EOMONTH(TODAY(),0)-WEEKDAY(EOMONTH(TODAY(),0))-1
This gives the last Friday of this month. You can replace both instances of Today() with any date you like or a cell reference that has a date to get the last Friday in any other month.
=WORKDAY.INTL((EOMONTH(A4,0)+1),-1,"1111011")

Resources