How to build accumulated sum per day in Excel? - excel

I have an Excel worksheet where I write down all the hours per day I work on my project.
During one day I just work some minutes here and there.
In one column of my sheet I would like to have the accumulated / added hours I worked at that specific day.
So once a row with day, start, and end is complete, the referring accumulated hours per day for this new row should appear.
I would like to have this cell prefilled, so that I do not have to make any manual adjustments of the contents of this cell.
How has a formula in column accumulated hours per day have to look like to achieve this?

You're looking for this:
=IF(A2<>A1,0,D1)+C2-B2
Ideally, I'd suggest avoiding references in the over row by using OFFSET. Try this instead:
=IF(A2<>OFFSET(A2,-1,0),0,OFFSET(D2,-1,0))+C2-B2

I would suggest creating a pivot table and there you can do many things.

You could also try an array formula version:
=SUBTOTAL(9,OFFSET(C2,0,0,ROW(A2:A9)-1))-IFERROR(SUBTOTAL(9,OFFSET(C2,0,0,MATCH(A2:A9,A2:A9,0)-1)),0)-
(SUBTOTAL(9,OFFSET(B2,0,0,ROW(A2:A9)-1))-IFERROR(SUBTOTAL(9,OFFSET(B2,0,0,MATCH(A2:A9,A2:A9,0)-1)),0))
or more dynamically using Excel 365 Let and Sequence:
=LET(range,A2:INDEX(A:A,COUNTA(A:A)),r,ROWS(range),
SUBTOTAL(9,OFFSET(C2,0,0,SEQUENCE(r)))-IFERROR(SUBTOTAL(9,OFFSET(C2,0,0,MATCH(range,range,0)-1)),0)-
(SUBTOTAL(9,OFFSET(B2,0,0,SEQUENCE(r)))-IFERROR(SUBTOTAL(9,OFFSET(B2,0,0,MATCH(range,range,0)-1)),0)
))

Related

Using Excel formula to find employee working times

I have an Excel sheet with over 1,500 rows of data. Each row tracks an employees start and stop time for a specific task and order number. I want to add up the total time for each person and/or location.
I tried VLOOKUP to try and do this, but it just returns an error. For example, if I want to look for Karen's total work time, I would do something like VLOOKUP(Karen,F:F,9,TRUE). What I get in return is an #REF!. I suspect this has to do with there being something like 100 rows that are related to Karen's work and the VLOOKUP isn't going to add all the values found together.
What I want is for the output, in one cell, to show the total time. I figured I might have to do something were it finds all of Karen's times and dumps them into a new column, and from there, I can sum them all up into a single cell to get the total time.
Example of Excel document
Like BigBen said in his comment, you should use SUMIFS to achieve that, along with a new column like you figured out.
I made a simple sheet in Google Sheets to exemplify it (functions used are the same in Excel).
Here's the link to it, and below is an image of it's contents:

Count seperate EXCEL cells if value >0

Background:
This excel is to track the hours someone works and what days. It also needs to track the total days worked in a week.
Requirement:
The 'Total Days' column needs to count the Monday(M) to Sunday (S) columns if they are greater than 0
Previously I had a simple COUNTIF(H6:K6, ">0") or whatever it was, which worked well.
Now the user has added in extra columns for pay and charge rates each day, after the corresponding day, which has thrown the formula off, and the COUNTIF formula wont do the columns separately inside the same formula.
Snippet of excel layout
Also some clarification, In AZ1 for instance I would want it to count H1, K1, N1, etc up to Z1
If anyone could help me work out a formula, that would be great!
COUNTIFS uses AND logic, whereas, you need OR logic. Try something like:
=COUNTIF(A3,">0") + COUNTIF(B3,">0")+...
EDIT: Since that didn't work, this should do the trick:
=COUNTIF(H5,">0")+COUNTIF(K5,">0")+COUNTIF(N5,">0")+COUNTIF(Q5,">0")+COUNTIF(T5,">0")+COUNTIF(W5,">0")+COUNTIF(Z5,">0")
Try using the MOD function to determine the stagger of the columns. SUMPRODUCT and ISNUMBER can take care of the rest.
=SUMPRODUCT(NOT(MOD(COLUMN(H:Z)-8, 3))*ISNUMBER(H6:Z6))

COUNTIFS to ignore hidden rows excel 2007

would appreciate help with this one. Made more tricky because it concerns Time. I currently have
=COUNTIFS(Data!A:A,">="&TIME(0,0,0),Data!A:A,"<"&TIME(1,0,0))
but it doesn't work when I hide rows.
I've managed to work out a similar issue for other data which now uses
=SUMPRODUCT(SUBTOTAL(102,OFFSET(Data!$H$1,ROW(1:10000)-1,))*(Data!$H1:$H10000<35))
but I can't work out the syntax for my Time calculation.
You can just add the time criteria in to that second formula, e.g.
=SUMPRODUCT(SUBTOTAL(102,OFFSET(Data!$H$1,ROW(1:10000)-1,))*(Data!$A1:$A10000>=TIME(0,0,0))*(Data!$A1:$A10000<TIME(1,0,0)))
...but if you are using hour long "buckets" it might be easier to use HOUR function, but you can't apply HOUR to text values ,so if row 1 contains headers start at row 2
=SUMPRODUCT(SUBTOTAL(102,OFFSET(Data!$H$2,ROW(1:9999)-1,))*(HOUR(Data!$A2:$A10000)=0))

Missing hours in Excel

I have a weather data in Excel taken every hour for 2008. Year of 2008 had 366 days thus 8784 hours. However, I noticed that there are 8767 rows and therefore 8784 - 8767 = 17 hours are missing. Unfortunately, I don't know which hours are missing throughout the whole year. I also have an extra column which displays the date along with the time in the format of "day-month-year time". E.g. 31-12-08 23:00.
Is there any method in Excel so the missing hours can be added as an extra row?
Thanks
Simply subtract one datetime from the previous one, if the answer is not 1 hour - then you know where the missing rows are. You can use a simple IF function for this, e.g.
=IF(HOUR(A2)-HOUR(A1)=1,"","Missing")
Of course, you need to copy this formula down a column so that it checks all the rows.
You can insert rows using a VBA macro, but there is an easier way without macros. Start a brand new worksheet. In A1 enter:
=DATE(2008,1,1)+TIME(0,0,0)
In A2 enter:
=A1+TIME(1,0,0)
and copy down. With proper formatting this will look ike:
This will be a complete set of date/times. At this point you can pick-up data from your original worksheet using VLOOKUP() or MATCH() / INDEX()
This will also allow you to identify the missing rows.

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