I'm attempting to use a DATEDIF function to calculate the days of between dates for days of rest a team has. Below is a picture with the values manually inputed. DATEDIF function doesn't allow additional criteria to be used. I tried nesting it in a countif and sumif to no avail. Any help would be much appreciated.
Days Rest
Your data appears sorted by date ascending. In B416 use this formula for the rest period (date minus previous date minus 1).,
'office 365 (and others) with MAXIFS
=if(countif(c$1:c415, c416), a416-maxifs(a$1:a415, c$1:c415, c416)-1, text(,))
'for xl versions without MAXIFS (xl2010 and above)
=if(countif(c$1:c415, c416), a416-aggregate(14, 6, (a$1:a415)/(c$1:c415=c416), 1)-1, text(,))
You should be able to copy that formula from B416 to B2 and fill down.
Related
I have a calendar year in Column A and am looking to find a match in column CA. There are multiple matches and within these I am then looking for the match that has "A" in the row next to it. there could be duplicates of this as well and so of those will copy the max value (In column CK). At the moment I have tried some looped vlookup() excel functions but have had no luck. Any help would be appreciated, thanks!
=VLOOKUP(A2&"A", $CA:$CK, 11, FALSE)
Use INDEX/MATCH instead of VLOOKUP().
=INDEX(CK:CK,MATCH(A2&"A",CA:CA&CB:CB,0))
In case of non 365 version of excel, you may need to array entry the formula with CTRL+SHIFT+ENTER.
I am trying to write a formula that counts all of the entries on a table that are on a specific weekday AND within a certain time range. Below is a sample table:
How would I write a formula to count all entries that occurred on a Monday between the times of 02:00-20:00?
I can get it to count entries within the time range with a simple COUNTIFS using >= and <= within the range using =COUNTIFS(Table1[Time], ">=02:01",Table1[Time],"<=19:59"), but am struggling adding the third conditional statement of weekday. I have tried playing around with the WEEKDAY function without success.
You can use:
=SUMPRODUCT((WEEKDAY(Table1[Date])=2)*(Table1[Time]>TIME(2,0,0))*(Table1[Time]<TIME(20,0,0)))
You may also try-
=SUM((TEXT(Table1[Date],"dddd")="Monday")*(Table1[Time]>=TIME(2,0,0))*(Table1[Time]<=TIME(19,59,0)))
May need CSE entry for older version of excel. CSE means enter formula by pressing CTRL+SHIFT+ENTER.
I have a time tracker and trying to count time spent in a given week using SUMIFS.
The week column is a formula that gets the week number from the date, and not a value by itself, and that seems to be tripping up the SUMIFS calculation, and it just returns SUM of zero. If I replace the formula with a written week number, it works.
Is there a way to force SUMIFS to work with the formula, or make it see the value of the cell instead of the formula?
A B C D
wk48 johnny 29-11-18 misc 10
wk48 johnny 29-11-18 inbound 130
wk48 johnny 29-11-18 meeting 30
Column A is =WEEKNUM(C,2).
My SUMIFS formula is =SUMIFS(D:D,A:A,"wk48"), but like I said, it only returns zero. If I change the data in column A to be just text instead of getting the week number by formula, it works just fine.
(I'm using SUMIFS instead of just SUMIF because I want to add other criteria as well, but for now I'm trying to get the individual criteria working before combining them together, and I'm stuck on this one.)
Any ideas? Thanks.
the WEEKNUM formula returns numbers, 48 in your case, and not the string "wk48". I suspect this is how the cell is formatted (the same way you can have a dollar sign in front of a number). Try =SUMIFS(D:D,A:A,48).
How do i sum up a range of amounts after checking through the month and year?
As you can see in the image, my code currently sums up all amounts by checking only on the month. This is incorrect as it should check the year as well before auto summing itself into the respective months and year.
Here is the Excel Cell code:
Cell C36="$"&SUMIF(B17:B23,"*."&TEXT(B30,"mm")&".*",E17:E23)-SUMIF(B17:B23,"*."&TEXT(B30,"mm")&".*",G17:G23)
I tried modifying the code to add in a "yy" as shown below, but it didnt work out. In fact the 2017 amount of $555 reflected in 2018 instead.
="$"&SUMIF(B17:B23,"*."&TEXT(B30,"mm")&"."&TEXT(B30,"yy")&"",E17:E23)-SUMIF(B17:B23,"*."&TEXT(B30,"mm")&".*",G17:G23)
What do I need to change?
BTW, Cells B30 and B36 are Custom formatted to "mmm-yy" while Cells B17 and B18 is Text.
managed to solve my own code.
Apparently its just a change in the parameters.
Cell C36="$"&SUMIF(B17:B23,"*."&TEXT(B30,"mm.yy")&"*",E17:E23)-SUMIF(B17:B23,"*."&TEXT(B30,"mm.yy")&"*",G17:G23)
Here is an alternative. SUMPRODUCT allows you to use RIGHT function to do the comparison for mm.yy.
="$" & SUMPRODUCT((--(RIGHT(B17:B23,5)=TEXT(B36,"mm.yy")))*E17:E23)-SUMPRODUCT((--(RIGHT(B17:B23,5)=TEXT(B36,"mm.yy")))*G17:G23)
I have collision data in column F I have the years from 2004-2015, I have named the range ATT_YEAR and In column G I have the dates and the range is named ATT_DATE. What I am trying to do is to either use COUNTIFS or SUMPRODUCT to determine the number of collisions by month of the year, if I select the year as say 2013, I want to show the number of collisions by month.
I was trying the following the formula:
=COUNTIFS(ATT_YEAR,"2013",ATT_DATE,MONTH=1)
but not getting very far with one.
Or when I tried using sumproduct formula:
=SUMPRODUCT(--(ATT_YEAR,"2013"),MONTH(ATT_DATE)=1)
I would be grateful for any assist on either of these.
I think you are using the formula wrong:
=SUMIFS(COLLISION,ATT_YEAR,2013,ATT_MONTH,1)
This will count all collisions in the named-range "COLLISION" only if 2013 is matched in the named-range "ATT_YEAR" and 1 (i.e. January) is matched in the named-range "ATT_MONTH".
edit
Needs updating, wrong assumptions.
You cannot use MONTH, which is the function you need, inside COUNTIFS. Instead, create another column, with the formula MONTH(B2), assuming column B has the date values, and use it as a new ATT_MONTH range:
=COUNTIFS(ATT_YEAR,2004,ATT_MONTH,6)