I have a table that I am trying to perform a sumif on, but the catch is I need the formula to filter the data by two range criteria first.
Column A = Date, Column D = User, Column H = time to be summed
Basically, I want to be able to sum the time values by user, but then I also need to be able to split this time between weekdays and weekends.
Thus, if user A has 1 session of 0:30 on Monday, Wednesday, Saturday and Sunday, then I want the formula to be capable of summing the 2 hrs such that I can have 1 column in a separate table with the weekday hours, and the column next to this with the summ of all weekend hours.
Any ideas you might have on how I can solve this with a formula rather than redesigning the tables (as they're not mine to redesign) would be most appreciated.
You need to move to a SUMPRODUCT function in order that you can introduce the WEEKDAY function to be used in the criteria.
The formula in K2:L2 are,
=SUMPRODUCT(($D$2:$D$99=$J2)*(WEEKDAY($A$2:$A$99, 2)<6), $H$2:$H$99)
=SUMPRODUCT(($D$2:$D$99=$J2)*(WEEKDAY($A$2:$A$99, 2)>=6), $H$2:$H$99)
Fill down as necessary.
Related
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.
I have a spreadsheet that tracks average file processing times over the course of a month. One of the macros and stats that we like to pull, is performance on Mondays (as the files are a little built up over the weekend). The spreadsheet is organized into columns by weekdays of the month:
The dates are formatted MM/DD/YYYY, so I would think Excel has a date function that it can determine weekday based on that date value.
Currently, I just have to manually tell the Macro which columns are Mondays, like so:
=AVERAGE(B20,G20,L20,Q20)
So, instead of manually, how would I get the average over the range of say, B20 to V20, only if the day of the week is Monday (the date cells are in row 1, so B1 to V1)?
To determine the weekday of a date in EXCEL use the =WEEKDAY() formula, which evaluates as 1 (Sunday) to 7 (Saturday)
e.g. If A1 contains 12/31/2016 (or 31/12/2016 if you're from where I'm from), the formual =WEEKDAY(A1) would evaluate to 7 (indicating that the last day of 2016 was a Saturday)
To apply this formula to your problem: (assuming that the dates are in row 1 and the values are in row 2)
insert a new row to hold the WEEKDAY() value (say, row 2)
in cell A2 type in =WEEKDAY(A1)
copy this formula as far right as necessary (to include all your dates)
Your average for Mondays is calculated as =AVERAGEIF(2:2, 2, 3:3)
Possibly, you can add a column called [Day Of The Week] and use the following formula to display the day.
TEXT(B4,"dddd")
Then add an 'If'statement to your result cell.
simply
=SUMPRODUCT((MOD(B1:V1,7)=2)*B20:V20)/SUMPRODUCT((MOD(B1:V1,7)=2)*1)
should give the average of all values from B20 to V20 if the corresponding cell in row 1 is a monday.
the first part sums the values of all mondays and the second part counts them (sum / count = average) ;)
If you have any questions, just ask.
If your date is in A1, you can use =Text(A1,"dddd") to determine the day of the week (it will return the name, "Monday", "Tuesday", etc.) so then you could do perhaps:
=If(text(A1,"dddd")="Monday",[do whatever],[do whatever]) (may need a helper row/column to hold the text of the weekday)
(Or use AverageIf() and use the Text() idea.)
I have some dates with time in my excel sheet, i was just wondering if there was a day to have a counter for each time it occurred in that hour. For example,
01-Jan-2015 05.04.18
01-Jan-2015 05.55.24
01-Jan-2015 06.01.45
02-Jan-2015 09.11.32
So there is 2 occurrences in the 05 hour of 1st Jan, 1 occurrence in 06 hour etc.
I would count it manually but there are over 10,000 lines.
Any idea how I could use a formula to set a counter, would I use COUNTIF, or concatenate it first?
I’m sorry if this sounds a little bit stupid, I am just a beginner.
Thanks for your help
If you have all the date occurrences in Sheet1, column A. You could have a list of hours in column A of a second sheet (01-Jan-2015 05.00, 01-Jan-2015 06.00, 01-Jan-2015 07.00 etc.). In column B in that sheet you place a COUNTIFS formula which counts all date occurrences between the date and hour in column A and column A + 1 hour:
=COUNTIFS(Sheet1!A:A,">=" & A1,Sheet1!A:A,"<" & A1+(1/24))
See COUNTIFS function for reference.
Can anyone help please?
I have a spreadsheet where A:A contains dates and B:B shows the amount i spent on that day in relation to the date in A:A.
What i would like to do is have C1 show a running total of what i have spent this week.
I am using Excel 2007 and i cannot get my head around this.
I am going round in circles here, i can get =SUMPRODUCT((WEEKDAY(A2:A1000)=5)*(B2:B1000)) which shows how much has been spent on a thursday, justcannot work out how to say for the last week
You can apply the SUMIFS function with the TODAY functio and WEEKDAY function to gain a total of the current week.
'for a Sunday to Saturday week
=SUMIFS(B:B, A:A, ">"&TODAY()-WEEKDAY(TODAY()))
'for a Monnday to Sunday week
=SUMIFS(B:B, A:A, ">"&TODAY()-WEEKDAY(TODAY(), 2))
'for the previous Sunday to Saturday week
=SUMIFS(B:B,A:A, ">"&TODAY()-WEEKDAY(TODAY())-7,A:A, "<="&TODAY()-WEEKDAY(TODAY()))
=SUMIFS(B:B, A:A, ">"&TODAY()-WEEKDAY(TODAY(), 2)-7,A:A, "<="&TODAY()-WEEKDAY(TODAY(), 2))
The total for other 7 day periods can be returned with a little maths.
I've used the SUMIFS function here as the syntax changes between the SUMIF function and SUMIFS. Using SUMIFS in all cases means that you do not have to alter the syntax depending on whether you are using it one condition or multiple conditions.
Make it simpler.
Add a column before the DATE column and call it WEEK
In A2 use (x should be 1 , 2 depending on the system for your country)
=Year(B2)&WeekNum(B2,x)
1 = week start sunday
2 = week start monday
then in D2 use ( and drag it down the column)
=SUMIF(A$2:A2,A2,C$2:C2)
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