excel count sets of dates that date is between - excel

Here is my data model: I have an excel sheet with each row representing a date range (an event). There is significant overlap. A2 might be 4/10/15, and B2 might be 4/12/15; while A3 might be 4/11/15 and B3 might be 4/12/15.
I am trying to get a count for each day of the year 2015 how many events occurred on that date. with my limited "for instance" I would get something like:
4/9/15 0
4/10/15 1
4/11/15 2
4/12/15 2
4/13/15 0
I have some sudo code for this if I were to just save the set as a csv and use java or something to grab each date and create an object but I find it hard to believe that excel is not capable of this on it's own.
We tried a wild number of countif and countifs statements but I am really just at a loss when it comes to excel.
I thought I was close with this:
=COUNTIF(Sheet2!A2,AND(Sheet2!A2>=(dates!B*), Sheet2!A2<=(dates!C*)))
but in order to get that to work I would need it to iterate through each row of dates and I am just not sure how to do that.
Any help is appreciated. As a backup plan I am refining my sudo-code for a possible vb excel script (never done that before) or just breaking it out into java and using the old text edit scripts I haven't had to touch since college labs.
Thank you for any help.

Your keyword is COUNTIFS
Say your criteria day is in cell Sheet2!A2 and your event ranges are in sheet Dates columns B and C; Try this formula:
=COUNTIFS(Dates!B:B, "<="&Sheet2!A2, Dates!C:C, ">="&Sheet2!A2)

Related

Use VLOOKUP as criteria inside COUNTIFS

After years of using this community, I have a question that I can't find an answer to. I hope you all can help!
I am trying to get a count of the number of "Grounded" items that each individual is overdue for. My screenshot (Count Tracker) shows a very condensed version of what I'm working with. Columns A-C is my large (15,000 rows) data field that is imported from an external source. In columns G-H I have listed each possible task (about 100 rows) and the type (Grounded and Non-Grounding plus many others). Column F is where I am trying to get the count.
My formula in F9 currently uses COUNTIFS to get a count of the instances in the large array that equal E9 ("Smith" in this case) and where the due date in the large array is less than or equal to the current date in F8. What I can't figure out is how to also add to count the Tasks in the large array where the task type in Column H equals "Grounded". I tried VLOOKUP, but it seems it doesn't like it and tells me there is a problem with the formula. It doesn't work, but here's the general idea of what I'm after:
=COUNTIFS($A$2:$A$7,$E9,$C$2:$C$7,"<="&$F$8,VLOOKUP($B$2:$B$7,$G$2:$H$4,2,FALSE),"=Grounded")
With how the data is currently presented, Smith should have a count of 1 and Jones should have a count of 0. I have a feeling that this is more simple than I'm making it to be, but I can't figure it out. I am using Excel 2016.
Hopefully I explained the problem well enough. Thank you for your assistance.
With Excel 2016 I'd say MMULT() is a good alternative here:
CSE-Formula in F9:
=SUM((A$2:A$7=E9)*(MMULT((TRANSPOSE(G$2:G$4)=B$2:B$7)*(TRANSPOSE(H$2:H$4)="Grounding"),ROW(G$2:G$4)^0))*(C$2:C$7<=F$8))
You could add a fourth column that stores whether that Task is Grounded
The formula for D2 would then be:
=INDEX($H$2:$H$4,MATCH(B2,$G$2:$G$4,0))
Modify your CountIfs formula to use this new column as a criteria
=COUNTIFS($A$2:$A$7,$E9,$C$2:$C$7,"<="&$F$8,$D$2:$D$7, "Grounded")
Try this Sumproduct+Vlookup formula without helper solution, and can work for your Excel 2016
In F9, formula copied down :
=SUMPRODUCT((A$2:A$7=E9)*(VLOOKUP(T(IF({1},$B$2:$B$7)),G$2:H$4,2,0)="Grounded")*($C$2:$C$7<=$F$8))

Indirect Function with Sheet Names

I have a list of all of the sheet names in my workbook on Sheet1 and I am trying, without success, to use the INDIRECT function to reference a cell on another sheet using said name. I am aware that this is a common question, I have looked at about 10 other questions/answers on this website in addition to others. For some reason, those solutions are not working and I am kinda losing my mind.
The sheet names are all in column A
They are named after dates (format mm-dd-yy) <- I'm assuming this is the problem?
The cell that I am trying to reference is always in O1 on every sheet in the workbook.
I have tried:
=INDIRECT(A1&"!O1")
=INDIRECT("'"A1"'&!O1")
and a few other amalgamations. Again, I have looked into so many other solutions at this point I am just left with asking for help with my situation, which is apparently unique (or more likely it is some blaring user error). Please help me before immediately removing the post.
If I have this right, the names of your sheets are dates, and you have the names listed as dates in Column A. So, they will appear as dates, but are actually Excel's background number for a date (days since 1/1/1900).
If you use the Formulas tab in the ribbon to Evaluate Formula, you should see the date pop in to your formula as a 5 digit number.
If you are not doing anything else with these dates, you could try selecting column A and formatting as text. This solved the issue in my test setup. This will still work if you are using the date for other functions, but you will have to tell Excel it's a date using DateValue()
After formatting Column A as text, I used =INDIRECT("'"&A1&"'!O1")
Try,
=indirect(text(a1, "\'mm-dd-yy\'\!\O\1"))

sum up all cells between dates that is a text

I have 2 tables. In first table I have project name and the cost for each project. The project names always start with data (yyyymmdd) for instance 20171201_Project1, 20171202_Project_2 etc. In second table I have dates and Summary of language 1
What I would like to do is to sum up all projects in Sheet2 between 2 dates so if I have done 7 projects between 20171201 and 20171211 I would like to have a formula that will sum them up.
I am currently using this formula:
=SUMIFS(Sheet1!F:F,Sheet1!A:A,">20171201*",Sheet1!A:A,"<20171211*")
However, I always have to put the dates manually. What I want to do instead is to use dates from column A in Sheet2 to indicate the range of dates. You can download the Excel file from here. I pout there new formula that doesn't work as well.
I have tried to use this formula but it doesn't show me correct value.
=SUMIFS(Sheet1!F:F,Sheet1!A:A,">=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2))*",Sheet1!A:A,"<=DATE(LEFT(A3,4),MID(A3,5,2),RIGHT(A3,2))*")
Regards,
Adrian
If I understand what you want, SUMPRODUCT may be a better fit.
Something like:
=SUMPRODUCT((LEFT(projCosts[Project Name],8)>=TEXT(A2,"yyyymmdd"))*(LEFT(projCosts[Project Name],8)<TEXT(A3,"yyyymmdd"))*projCosts[Cost])
Where the dates of interest are in A2 and A3 (in this example). Note that, depending on the precise date range you want, you may need to change the equality operators (<,>=) to include/exclude the equal sign.

Excel Formula to Count Values between Dates

I am looking for a way to count how many companies are in Column C on the specific dates of column A. Can one formula be applied to the count between all of dates?
I have tried looking up and using =CountBlanks and I do not want to have to manually select the cell ranges between the dates.
Ultimately I am also trying to put this data into a table so I can see on Feb 16 = 3 Companies, Feb 19 = 5. I can not use a VBA script as some users have macros blocked.
Please look at image for example
Example Image
Try this formula:
=COUNTA(INDEX($C$2:$C$21,MATCH($E2,$A$2:$A$21,0)):INDEX($C$2:$C$21,MIN(IFERROR(MATCH(TRUE,INDEX($A$2:$A$21>$E2,0),0),9999999),MATCH(TRUE,INDEX($C$2:$C$21="",0),0))-1))
Change the 21s in the formula to at least the extent of your data +1, It can be more, Full column references will not work due to the Word "Date" in the first row.
DATEDIF( start_date, end_date, interval )
you didnt even bother to google this, right?
edit: there should be enough common place stuff like isblank to accommodate the lack of values. If youre trying to find the values between A & C then you can easily adjust your formula accordingly.

sumif some columns value based on other column

I created the time log for what I do:
To better illustrate, I attached the image as follows:
where start and end are the time when I started the particular task in the column A, and delta is the difference between the values in End and Start.
In the next sheet, I created the the summary of how much time I spent on each criteria like this:
Now the problem I had is:
1) The formula I have in the hour field in the summary sheet is this:
=sumif('Time spent'!$A$2:$A$100,A3,'Time spent'!$D$2:$D$100)
How do I make it so that values are up for the entry put in today? The reason why I want this feature is so that I can see my performance for today.
I have this on Google Doc, but I also would like to know how to get this done in Excel as well
In Excel, starting in version 2007 you can use the SUMIFS function - which allows multiple conditions. In your case, the syntax would be:
=SUMIFS('Time spent'!$D$2:$D$100,'Time spent'!$A$2:$A$100,A3,'Time spent'!$E$2:$E$100,TODAY())
In Excel 2003, you can do this with a SUMPRODUCT:
=SUMPRODUCT('Time spent'!$D$2:$D$100*('Time spent'!$A$2:$A$100=A3)*('Time spent'!$E$2:$E$100=TODAY()))

Resources