This command line gives the last work day of the month (True or False). I don't know how to change the commands to get the first work day of each month. If we are assuming the entire column A is the Date. format is mm/dd/year
AND(WEEKDAY(A2,2)<6,MONTH(WORKDAY(A2,1))<>MONTH(A2))
The first day of the month is
date-DAY(date)+1
In your case:
A2-DAY(A2)+1
To check weather A2 is the first day of its month:
A2 = A2-Day(A2)+1
'Simplify equation
Day(A2) = 1
So as a result =(Day(A2)=1) evaluates to True/False
Regarding your formula weather a date is the last day of the month, that can be done by:
=(A2=EOMONTH(A2,0)
I believe this is what you're looking for
=DAY(A2)=1
Related
I'm trying to get the last value of each month of the year, but when I enter other dates from different ages the result doesn't match, it gets just the value from the last month.
Worksheet Image
Assuming that
I understand your requirement correctly
you don't actually want to try to calculate the value on the last day of a month for which you have no data (E8 & E9)
then you can use the formula below
=INDEX($B$1:$B$16,MATCH(EOMONTH(E4,0),$A$1:$A$16))
How can one return the next date of a given weekday (it could be either a number 1-7 or names Sunday-Saturday).
For example, if today, on Friday 16-Oct-2009 I passed in:
Friday, it would return today's date 16-Oct-2009
Saturday returns 17-Oct-2009
Thursday returns 22-Oct-2009
Here is the Spreadsheet
I have tried this formula:
=A12+(C12+ MOD(7-day(A12),7))
I worked out an answer to my own question
Here is the formula
=date(year(A12),month(A12), day(A12) + mod(C12+ 7-WEEKDAY(A12),7))
This worked for me:
=TODAY()+MOD(4 + 7-WEEKDAY(TODAY()),7)
Just replace TODAY() and 4 (weekday#) for your context.
This is the formula you are seeking.
=A12+(7-WEEKDAY(A12)+B12)
A12 holds the start date. B12 holds the ID of the targeted weekday, e.g. 1 for "Sunday".
A11 must hold a true date, as opposed to a text string that looks like a date. If the latter is the case an error will be displayed. The result is always a date. You can format that date as "dddd" to display a day's name or "dddd, dd-mm-yyyy" to display both date and day.
And here are the mechanics of the formula:- A12-WEEKDAY(A12) returns always the previous Saturday, a date that is always in the past. A12+(7-WEEKDAY(A12)) inverts that calculation, returning always the next Saturday. This date is always in the future except when A12 is a Saturday. That's when the result will be = A12.
Having found a stable base, you can just add the day you want to the Saturday you have. Add 1 (for Sunday) and you get a Sunday. Add 7 and you get a Saturday. All these dates will be in the future.
That's all as you want it except that if WEEKDAY(A12) = B12 you want the same date as in A12 which is a week earlier than the one the formula prefers. This is where I went wrong while in haste. My apologies! This is the correct modification of the formula's result, to wit, conditionally deduct 7 from the calculation.
=A12+(7-WEEKDAY(A12)+B12)-IF(WEEKDAY(A12)=B12,7,0)
I need an Excel formula that takes a given day and provides the next upcoming Thursday of that week. I have a list of dates with time stamp attached:
Date Week Ending
10/5/2015 10/8/2015
10/11/2015 10/15/2015
10/21/2015 10/22/2015
10/27/2015 10/29/2015
I want to convert it to the weekending. The example is of my date and the "Week Ending" I want the formula to show.
Assuming Date is in A1, if #Grade 'Eh' Bacon's solution is not working for you and given your mention of time stamp attached, maybe treat your dates as text and say, in B2 and copied down to suit:
=LEFT(A2,10)+(7-WEEKDAY(LEFT(A2,10),15))
Assuming your data is in A1, the formula is simply:
=A1+(7-WEEKDAY(A1,15))
Weekday(A1,15) gives the number of the day of the week of a given date, and the option ,15 says use a week starting with Fri and ending with Thurs. So, a given date, + (7-Weekday()) will give you the number of days required to get to the 'week ending with the Thursday on x date'.
If you want a Thursday to return the same date, then try:
=A1+7-WEEKDAY(A1+2)
The more generalized version would be:
=A1+7-WEEKDAY(A1+7-DOW)
where DOW (DayOfWeek) translates
Sun = 1
Mon = 2
...
Sat = 7
I need to convert an Excel calendar week date into the actual date.
Excel calendar week format = ww.yyyy (e.g. 31.2014);
Expected output = 7/28/2014 (return the Monday of the week)
What formula should I use ?
It's a bit of a pain: there's no direct function. If A1 contains the year, and A2 contains the week number then,
=MAX(DATE(A1,1,1),DATE(A1,1,1)-WEEKDAY(DATE(A1,1,1),2)+(A2-1)*7+1)
will return the date corresponding to the Monday of that week in that year.
To test it, use =WEEKNUM() and =YEAR() on the computed result, along with =TEXT(,"DDD") to prove it's a Monday.
If #Bathsheba's response works for you, you can do everything in cell B1 with the following command
=MAX(DATE(LEFT(B1,FIND(".",B1)),1,1),DATE(LEFT(B1,FIND(".",B1)),1,1)-WEEKDAY(DATE(LEFT(B1,FIND(".",B1)),1,1),2)+(MID(B1,FIND(".",B1)+1,2)-1)*7+1)
This allows you to put YYYY.WW in B1 and it splits it up for you in the calculation.
I've got a column full of dates. How can I check that column to find which date is within a month of todays date, and then return it?
If there is no date within a month, just return blank
Lets say my dates are:
01-Jan-12
01-Apr-12
01-Jul-12
01-Oct-12
01-Jan-13
The code im using is below. A:A is the range of the dates above
=MIN(IF(A:A>TODAY(),A:A))
The issue im having is that if I use the above, it returns 01/01/12 and not 01/01/13. Also, if I change the dates so the next date is December 1st 2012, it still returns 01/01/12
So you really just want the earliest date if that's within a month? If so perhaps try
=IF(MIN(A:A)-TODAY()<=30,MIN(A:A),"")
Assumes dates in column A
If you have past and future dates try this formula
=IFERROR(SMALL(IF(A2:A100>=TODAY(),IF(A2:A100<=TODAY()+30,A2:A100)),1),"")
confirmed with CTRL+SHIFT+ENTER
or for exactly 1 month (rather than 30 days) try using EDATE, i.e.
=IFERROR(SMALL(IF(A2:A100>=TODAY(),IF(A2:A100<=EDATE(TODAY(),1),A2:A100)),1),"")