I want to find the difference in years between two dates, in two different columns.
1st column: Is the fiscal year shown as 'YYYY', e.g. 2007. This column is formatted as 'General'
2nd column: Is the year a person became CEO shown as 'MM/DD/YYYY'. e.g. 11/28/2011.
This column is formatted as date.
I want to calculate the time a person has been CEO per fiscal years, meaning the difference in the two dates in years. e.g. column 1: 2008 / column 2: 5/25/2004 / difference: 4
Thanks
Try this code:
=A1-(RIGHT(B1;4))
Assuming your year is in A2 and Date is in B2 then try this...
=A2-YEAR(B2)
And then format the formula cell as General.
Related
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
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.
How to turn column of four digit years entered in general format into a date column or yyyy simply? I have a column of two digit months 1-12 and a column of four digit years and then found I should have used a date format. I would like two convert these hundreds and hundreds of entries into a useful date format with a formula or minimum of fuss or programming logic so I can perform useful analysis on the data and don't have to manually re-enter large amounts of data.
I have excel 2007
Thanks for any help
Use on of the following formulas in an unused column's row 2,
=DATEVALUE("1/1/"&A2) '<~~ 01-Jan-2015 when 2015 in A2
=DATE(A2, 1, 1) '<~~ 01-Jan-2015 when 2015 in A2
Format the cell (Ctrl+1, Number, Custom) as yyyy then fill down or right as necessary.
Do not use the YEAR function. For 2015, you will get 1905. This is because dates are 1 for every day past 31-Dec-1899 and 07-Jul-1905 happens to be the 2015th day since 31-Dec-1899.
I believe this is what you are looking for, where A1 would be the location of the cell that you have stored a four digit year as text:
=TEXT("1/1/" & A1,"yyyy")
In excel, I have a table that contains dates in the format mm/dd/yyyy. I am trying to gather some stats on this table, more specifically how many there are from a month number that is stored in another cell and the current year. So for example if the value in the other cell was 1 and the current year was 2015 I would want to return the number of dates from January 2015. Would this be possible by a count if statement? Any help with this issue would be greatly appreciated.
With A1 being the cell containing the Month number, try:
=COUNTIFS(TableDateColumn,">="&DATE(YEAR(TODAY()),A1,1),TableDateColumn,"<"&DATE(YEAR(TODAY()),A1+1,1))
I encountered a practical problem that can be simplified as follows:
My excel sheet has a single column which is the date I had a beer can. It can repeat based on the number of beers cans I had a day. (eg. I had three beers on 5/9/2012) I need to generate the trend of my beer consumption per week. How can I do it in excel?
**Date of beer**
5/9/2012
5/9/2012
5/9/2012
5/12/2012
...
7/3/2012
You could make a pivot table. Date as a row field, Count of Date (i.e., count of beers) as a data field. Group the row field Date by 7 days to get weekly totals.
You'd probably be better off with a two column spreadsheet. Column A = Date; Column B = Number of cans. Then you could easily just make a line graph from that.
If you already have a large amount of data in your format you can use excel's subtotal function to create the two column format for you.
First i would put a formula in to get a week number for each date, and then use a count if for each week of the year.
This formula will assign each day of the year the week number of the year it falls in. Put this in each cell next to your dates.
=IFERROR(1+INT((AF12-DATE(YEAR(AF12+4-WEEKDAY(AF12+6)),1,5)+WEEKDAY(DATE(YEAR(AF12+4-WEEKDAY(AF12+6)),1,3)))/7),0)
Once that is done create a column of numbers 1-52 (53 for leap year) and do
=countif(rangeofcalcdweeknumbers,week1to52)
and copy that down for all 52 or 53 weeks
Then make a graph based on the final two columns