spreadsheet Determining days between two dates when criteria met - excel

Could not find the answer to this one although it seems not too hard: calculate number of days between day and a day in the next x rows marked as a settlement day (=TRUE)
Please see example sheet for setup:
https://docs.google.com/spreadsheets/d/1E8bGpB8_xj1WECHOuP4Q0nH7Cx2FHilWvZ9h3ih0KwE/edit?usp=sharing

In C4:
=INDEX(A4:$A$1004000,MATCH(TRUE,B4:$B$1004000,0))-A4
Note: It depends on the dates in Column A being true dates and not text that looks like dates.
For Google Sheets the above formula will work but it can be truncated to:
=INDEX(A4:$A,MATCH(TRUE,B4:$B,0))-A4

Related

count repeated date as one in excel

i want to count working days in a week by mentioned dates only like in picture only 4 working days will be considered in filtered data "year, month, and Week are derived by induction date column.Example
Do want that repeated dates are considered into the counting or not? Anyway, you could apply workday formula (=WORKDAY (start_date, days, [holidays])) in an additional column and count from there, adding or criteria with IF formula or other logic to exclude repeated dates if you do not want to consider them.

How to make criteria in AVERAGEIFS update automatically?

I am trying to make my AVERAGEIFS criteria update automatically according to the day of the year (in this case only for 2014). My original AVERAGEIFS formula works perfect =AVERAGEIFS($B$2:$B$35041,$A$2:$A$35041,">=1/1/2014",$A$2:$A$35041,"<1/2/2014"), but I have to manually edit it for each day of the year.
I have tried modifying formulas I have seen in other posts here, but no luck so far. I want to average the values in column B (Amount) for each day in column A (Date). I have 96 time slots for each day of the year, hence the 96 entries in column A with the same date, e.g. 1/1/2014 and so on until 12/31/2014. How can I modify the formula so that it automatically adjusts the day when I drag it down?
Here is a screenshot of the data:
Screenshot of data
Any help is much appreciated!
EDIT: Updated formula below; I had misread the original question as to how your data was formatted. You can put this formula in B2 and copy down.
=AVERAGEIFS($B$2:$B$35041,$A$2:$A$35041,">="&$A2,$A$2:$A$35041,"<"&($A2+1))
Your original comparison operator hardcoded a date as a string. We can simply concatenate the value of a cell into that comparison string instead.
Granted, this will do the same calculation for each of the 96 entries for each of the days in your sheet. You could add a second sheet for the averages with just the distinct days of the year listed in A and an average calculation in B.
EDIT 2:
If your entries in column A have fractional date information (i.e. with hours, minutes, and seconds), converting the dates to integers will drop any fractional component:
=AVERAGEIFS($B$2:$B$35041,$A$2:$A$35041,">="&INT($A2),$A$2:$A$35041,"<"&INT($A2)+1)

filter data between 2 dates in excel using VBA

i was wondering if someone can help. i have tried some formulas but cant seem to work this out. i have a list of data with lots of dates some duplicate dates which are fine. i have data on a daily basis from 2015-2018. my aim is to try to put a number against each week between 2 dates so Monday-Sunday representing a week. so if the date falls between to dates bring back the week number. but of course there is a long list of date ranges and week ranges. does anyone know a formula or code to read to date and look between 2 separate dates and bring back a week number
thanks
Muj
For a given date, weeknum() will return the week number:

SUMIFS with Date Range...but X days before and X days after

I am trying to create a SUMIFS function that is adding totals based on several parameters. The final parameter is to use a date in a column and then look for any dates 7 days prior and 7 days after.
I have a list of invoices I am trying to sum up based on travel...conceivably people who are traveling will travel in a short duration. I cant add all invoices up because someone might travel at the beginning of the month and at the end, creating 2 trips.
Lets say the date is in Column I and my criteria cell is I10, I tried to enter the Criteria Range as "(I10-7)=>I10<=(I10+7)"
But this is clearly wrong. Any help is appreciated!
Try,
=sumifs(A:A, I:I, ">="&I10-7, I:I, "<="&I10+7)
Add your other criteria pairs making sure that the criteria ranges are the same number of rows as the sum range.

Excel - Highlight holidays on timesheet based on list of holidays

I have a list (for the rest of the year) of our recognized holidays at work, I want to highlight the row (just like I have the days off) if the day is one of the holidays. I have the dates for the holidays in text format in row O.
Them being text I figured I could use the same formula I am using for off days
=OR(LEFT(TEXT(C$8,"ddd"),2)=LEFT($G$5,2),LEFT(TEXT(C$8,"ddd"),2)=LEFT($H$5,2))
I just cant figure it out :/
Working off your previous formula I would use something along the lines of the following:
=SUMPRODUCT((LEFT(TEXT(C$8,"mmm"),3)=LEFT($O$3:$O$12,3))*(DAY(C$8)=--RIGHT($O$3:$O$12,2)))
Basically the formula will return the value of 1 which is equivalent to true for excel math if the first three letters of the month match and the date's day number match. All other results should return 0. It is also imperative that you do not have duplicate holiday dates in your list or the formula will return a value greater than 1. But there are ways around that too, but that is a follow up question.

Resources