Excel - Return dates in a list that are within 1 year of another date - excel

I'm trying to write a formula that would return a date (B) from a list if that date is within 1 year of another date (A). If there are no dates in the list that are within 1 year of date A, then date B will simply be date A plus 1 year (365.25 days).
For example: My list is [2/15/16, 12/26/17, 5/15/19]. If date A is 1/1/16, then I want Date B to equal 2/15/16. If Date A was 2/15/16, then Date B would be 2/15/17.
The closest I've gotten is:
=IF(MIN(L:L)-A<=365.25,MIN(L:L),A+365.25), but obviously this won't work beyond the minimum date. I need to check against the whole list of dates, not just the minimum date.
My end goal is to make a list like this (column A after the first date is just the previous B:
From (A) - To (B)
1/1/15 - 1/1/16
1/1/16 - 2/15/16
2/15/16 - 2/15/17
2/15/17 - 12/26/17
Thanks for any tips in advance!

If I understand correctly, this should work
=IFERROR(LOOKUP(2,1/((($A$2:$A$4-C2)<365.25)*(($A$2:$A$4-C2)>0)),$A$2:$A$4),EDATE(C2,12))
Column A has the list of dates, C2 has Date A. Running some more dates in column C, copying the formula down:

Related

SUMPRODUCT difference between two dates for THIS WEEK entries only

I have a column D containing all the Dates in DD/MM/YYYY format, and I would like to show the count of missed days for THIS WEEK values only from all the entries in column D.
In other words, if there is a difference between two Dates in column D and it occured this week, I would like to count it.
I have below formula to calculate "Total days missed" between first and the last entry in Dates column D, however I can't adopt this formula to display "Days Missed" for THIS WEEK only entries.
=SUMPRODUCT(--ISNA(MATCH(ROW(INDIRECT(MIN($D$18:$D$500)&":"&MAX($D$18:$D$500)));$D$18:$D$500;0)))
Sample of data set.
Please help, thanks.
For O365, in accord with your statement that there can be multiple entries of one date, I suggest the following (assuming your dates are real dates and not text strings that happen to look like dates):
Total Missing Dates
=MAX($D$18:$D$500)- MIN($D$18:$D$500)+1-COUNT(UNIQUE($D$18:$D$500))
Missing Dates THIS WEEK obviously, you'll need to define the first and last dates of THIS WEEK
=7-COUNT(FILTER(UNIQUE($D$18:$D$500),(UNIQUE($D$18:$D$500)>=wkStart)*(UNIQUE($D$18:$D$500)<=wkEnd)))
If your week starts on Monday, you can calculate:
wkStart: =TODAY()+1-WEEKDAY(TODAY()-1)
wkEnd: =wkStart+6
More generally, to return a particular day of the week prior to someDate (or wkStart):
wkStart = someDate - WEEKDAY(someDate - DayOfWeek)
where DayOfWeek is: Sunday=1 Monday=2 , etc
So, making someDate = TODAY()+1 ensures that if today is monday, it will return today and not the monday from a week ago.
HINT: It might be more convenient to define wkStart and wkEnd as a Named formula.

Excel SUMIFS Statement - Calculate profit for each month across multiple years

I've got three columns of data.
Sell Date - Column G - Contains the day, month and year in dd/mm/yyy format.
Month (calculated from sell date) - Column I - Contains month number
Profit - Column M - Profit in Dollars.
I am trying to calculate the profit made in each month and year.
Current formula using SUMIFS. I look at the data in Column I and if this contains a 1, and if G contains the year 2016 then it's January 2016. Think it's the year function that I don't quite get.
=SUM(SUMIFS(M9:M50, I9:I50, {"1"}, G9:G50, YEAR=2016))
You can create another column that shows just the year year(G2) or you can use this formula
=SUMIFS(M9:M50,G9:G50,">=1/1/2016",G9:G50,"<1/2/2016")
I also like this formula that allows you to reference the date in one cell and calculate a 1 month range. Put 01/01/2016 in cell A1 and the formula does the rest.
=SUMIFS(M9:M50,G9:G50,">="&A1,G9:G50,"<" & EDATE(A1,1))
The SUMIFS function doesn't like it when you alter the value of the IF parameters. It would be better to use a SUMPRODUCT formula to calculate this, for example:
=SUMPRODUCT((M9:M50)*(I9:I50=1)*(YEAR(G9:G50)=2016))
Where:
(M9:M50) are the values you wish to SUM.
(I9:I50) are the month values and 1 is the month you wish to specify.
(G9:G50) are the date values you wish to obtain the year from and 2016 is the year you are specifying.

How to sum values based on same date and name

I am trying to sum up Excel cells if they have the same date and name. In my case the column P is what I want to sum up. Column B is the date and column A is the name. Below is my attempt but it's not working. This formula works if I have ">=" but I want it calculate for specific day
=SUMIFS($P$4:$P$1000,$B$4:$B$1000,">="&Q2,$A$4:$A$1000, "="&R2)
If hte dates in column B are actually datetimes then you will have to bracket the date period just as if it was multiple days. Use >= for the start point and < start date plus 1 for the termination.
=SUMIFS($P$4:$P$1000, $A$4:$A$1000, $R$2, $B$4:$B$1000, ">="&INT(Q2), $B$4:$B$1000, "<"&INT(Q2)+1)
  
To guard against Q2 being a datetime as well, the INT function has been applied to strip off any time portion.

How to get the week number of the year from the date range in an Excel Pivot Table

Hi I would like to know a formula where I can convert a grouped date range into the week number of the year. For example column A has the date ranges. I want column B to have the week number. So it will be like the example below
Column A Column B
31/12/2013 - 06/01/2013............................................Week 1
07/01/2013 - 13/01/2013............................................Week 2
Thanks to anyone who can solve this. Its been bugging me out
You could perhaps use something like that:
=(RIGHT(A2,10)*1-41273)/7
This takes the last date in that date range, turns it into a number and subtracts 41273 (which is the equivalent of 1st January 2013) and divides the result by 7.
If you want to specifically get Week 1, you can either use custom formatting with "Week "#, or if you want the literal Week, you can use ="Week "&(RIGHT(A2,10)*1-41273)/7

Excel If Statement finding number of days between two dates

As an example I have three columns Target completion, Actual completion and Entered date
Column A Target Completion 1/5/13/2013
Column B Actual Completion 1/25/2013
Column C Entered Date 1/2/2013
I need to add 30 days to Column A (Target Completion) and then compare that new date to Column B (Actual Completion) and finally show the result in days.
Like this;
Column A Target Completion 1/5/13/2013
Column B Actual Completion 1/25/2013
Column C Entered Date 1/2/2013
Result = -10 days (30 days are added to column A then minus column B)
Column A Target Completion 3/1/13/2013
Column B Actual Completion 5/1/2013
Column C Entered Date 1/2/2013
Result = 30 days (30 days are added to column A then minus column B)
I have been trying to get this if statement to work …but no luck!! Thank you in advance.
=if(E14="",DATEDIF(DATEVALUE("06/28/2013"),TODAY(),"d"),DATEDIF(E14,C14,"d"))
Try EDATE() function
=Edate(A1,1)-B1
Reference .. http://office.microsoft.com/en-001/excel-help/edate-function-HP010342465.aspx?CTT=5&origin=HP010342402
Excel stores dates as the number of days since Jan 1, 1900, so to get the number of days just subtract. So to add 30 days to column A then subtract column B, in row 1 that would be:
=A1 + 30 - B1
The if statement would seem to be trying to do something like
=IF(E14="",TODAY() - DATE(2013,6,13),C14-E14))

Resources