Is there a way to obtain Month-Year from today's date and fill it down for the past 5 years?
such that it will dynamically change according to the month and year from my date.
Thanks for the help.
Use EDATE() to subtract one month in each row. Enter the following formula into A4:
=EDATE(A1, -1)
Then copy this formula down the A column.
Related
I am trying to establish the best way to write a formula to take a date that is inputted in a cell by a user and subtract it from the last day of the month (the due date), not taking into account what year it is. The cell that contains the formula will be in another cell, pointing at the user inputted date cell.
I have 12 columns running across with each with one of the months of the calendar year. In each column for the corresponding month is where the user will input the date they completed a task. I would like to subtract their input from the last day of the corresponding month in that column. I want to reuse this spreadsheet every year, so I do not want to account for the year in my formula. I hope this will prevent me having to update the formulas each year.
An example would be if the user inputted 2/24/17 into C7, because the column C is the column for February, I would like the result to be -3 (I am not worried about leap years at this point). If they inputted 3/11/17 into the same cell (C7), they would get a result of 11, because the date is 11 days past the due date.
Here is the formula that I started to use, but I believe it is relative to the current year.
=IF(ISBLANK(C7),"",C7-(DATE(YEAR(TODAY()),MONTH(1)+2,1)-1))
Here is a link to a picture of my spreadsheet. Thank you in advance for your help!
Solution
Changed YEAR(TODAY()) to YEAR(target cell). My new formula looks like:
=IF(ISBLANK(C7),"",C7-(DATE(YEAR(C7),MONTH(1)+2,1)-1))
Maybe:
=IF(C7="","",C7-EOMONTH(C7,-1))
(based on #barry houdini's Comment and subsequent OP clarification via a Comment).
I am trying to convert the Day column to a standard date format. 1 for Nov 1 (current month), 2 for Nov 2, and so on. Would be nice if the formula will display the current month. The format for the Day column is in general.
Alternately, use =A2+43039 and format cells as Custom: d-mmm
Also possible to use =A2+"10/31/2017" to make it clearer what you're doing in the formula.
However, if you want it to update with whatever the current month and year is, Ralph's answer is probably best.
Copy the following formula into cell B2 (if that's your Date column and Day is in the A column) and then copy it down:
=DATE(YEAR(TODAY()),MONTH(TODAY()),A2)
I am creating a Table in excel to help determine what the Bi-annual dates would be from an input date.
Example: If the start date of an agreement is 9/1/2017 and Ends 8/31/2018, the Bi-annual dates would be 2/28/18 and 8/31/2018. Dates of service would be 2 months before the end of the agreement period, and six months before the second service date (so 6/30/2018 and 12/31/2017 respectively).
Formula for this:
=IF(ISBLANK(O3), "",IF(EOMONTH(A1, 0)=EOMONTH(O3, -2), "BIANNUAL", IF(EOMONTH(A1, 0)=EOMONTH(O3, -8), "BIANNUAL", "")))
Where A1 refers to January, B1 would be February, and so on thru to December (L1). O3 is the Agreement End Date box, and will be static on the sheet. This formula work perfect for me.
What I am trying to get is a formula for the cells at the top that list the months (Jan-Dec). I need a formula that will put the date as 1/31/2018 for Jan, 2/28/2018 for Feb, 9/30/2017 for September (for the current year since September has not passed). The actual day needs to be the last day of the month, and if that month has passed, then the year should be for next year. I have been playing with the DATE function, but cannot get it nailed down.
What I have so far - January 2018:
=DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0)))
This works, but not each month will be in 2018. I need the year to change only after the month has passed.
I feel like I'm either over complicating things, or I need a way more complex formula. Please help.
In A1 place the following formula and copy right to L1 or as far as you need to go
=EOMONTH($O$2,COLUMN(A1)-1)
It will display the end of month dates starting with the starting month of the contract and increasing by 1 month for each column you move right.
In the image below, it is the same formula in row 1 and row 2. Row one I choose custom format instead of date and set the custom format to mmmm. 4 m's will give you the full month, and 3 m's will give you the 3 starting letters of the month.
I actually figured this out this morning just playing with the IF function. My goal was to have the sheet update itself without having to change the dates every time your open it. So that the file could be shared with others and all you would have to enter is the end of the contract date, and it will list out Biannual, Tri-annual, and Quarterly months (see image).
Formula:
=IF(DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0)))<TODAY(), DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0))), DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0))))
Where I used the serial for each month (in this case 1/31/2017, as I didn't need to worry about the year)
Results
I want to sum the values with-in a data range, subtract value within a specific day.
I'm able to do first part - SUM but got a problem when I tried to subtract.
Formula used on "Exclude Sunday" table
F3 =SUMIFS(B3:B17,A3:A17,">="&D3,A3:A17,"<="&E3)
Help on this above formula to subtract Sundays hours.
On Sunday Only table, help to add hours of Sundays only of each months.
I tried SUMIFS with WEEKNUM, but couldn't get the result.
Weeknum() returns the number of the week, which is not useful in your scenario, since you want to evaluate the week day. That is what the Weekday() function does quite nicely. With the defaults, Weekday() returns 1 for a Sunday, 2 for Monday, and so on.
You can use Sumproduct to calculate a sum of all hours between two dates where the weekday is not Sunday like this in cell F3 of your screenshot.
=SUMPRODUCT((WEEKDAY($A$3:$A$17)<>1)*($A$3:$A$17>=$D3)*($A$3:$A$17<=$E3)*B3:B17)
Copy down.
In order to sum all Sunday hours in January, you can use Sumproduct and compare the date formatted as "mmm" with the text in cell D10, and also use a condition to calculate only dates where the weekday is Sunday (i.e. 1). Cell E10 has the formula
=SUMPRODUCT($B$3:$B$17*(TEXT($A$3:$A$17,"mmm")=$D10)*(WEEKDAY($A$3:$A$17)=1))
I have a column 'day' (C6:C37) showing the day of the month and a column 'dailytotal' (F6:F37) showing the total expenditure on each day. I want to calculate total expenditure only on weekends.
How do I calculate the sum of values in 'dailytotal' when Saturday or Sunday is in column 'day'. How can I use SUMIF here for my requirement?
You can use the WEEKDAY function to determine what day a date falls on. However, there's no way to use that directly with a SUMIF formula.
Alternatively, you can use a SUMPRODUCT formula:
=SUMPRODUCT(--(WEEKDAY(C6:C37,2)>5), F6:F37)
If you HAVE to use sumif (though Michael's solution works nicely). Here is what you can do.
Add a column (I will refer to as "weekday_range") that takes the =weekday(date, 2) (and fill down column)
THEN you can use
=sumif(weekday_range, ">5", daily_total_range)
you can then hide the column that weekday_range is in if needed