I have an Excel file where I have a few sheets. On one I keep track of my hours I work a the office. The other sheet is used to track the hours I spend travelling.
This is sheet1.
Date Hours
27/11 8
28/11 8
29/11 7
This is sheet2.
Date Hours
27/11 0
28/11 0
29/11 4
I would like to have a column on sheet1, that adds the hours depending on the dates. For example,
Date Total Hours
27/11 8
28/11 8
29/11 11
How would I go about doing this?
Assuming that your date column starts in A2, this should work:
=SUMIF(Sheet2!$A$2:$A$4,Sheet1!A2,Sheet2!$B$2:$B$4)+Sheet1!B2
The conventional solution is not to have the travel hours on a separate sheet in the first place (or if they are needed elsewhere to obtain them from the sheet1). When together with the office hours the data is more compact (e.g. the dates only entered once), so requires less storage space, the ‘picture’ provided by sheet1 ‘at a glance’ is more comprehensive (it may not be coincidence that the one day in the example showing travel time is also the one day with below average hours work at the office) – and the formula is simple, not requiring a question on SO, is easier to maintain, faster to process etc.
I would like to have a column on sheet1, that adds the hours depending on the dates.
Assuming consistency in layout (e.g. say Date is in A1 on both sheets), then copying sheet2 ColumnB into sheet1 ColumnC, inserting Total into sheet1 D1 and entering:
=B2+C2
in sheet1 D2 and copying down would appear to meet your requirement and have the other advantages mentioned, though I suspect not quite the solution you wanted. In your last example you do not show the Hours column that you already had in sheet1 and if this is part of your objective you might, after the above, just hide ColumnsB:C.
Related
I'm trying to help someone with an Excel spreadsheet of sales figures. I hope this explanation is clear. She has a worksheet for each category of items she sells, such as clothing, shoes, furniture, &c. Each worksheet has a column, G, for Date Sold, and the data is in Date format.
On a summary worksheet, she wants to aggregate and analyze the data, and one thing she was doing manually was counting the number of sales of each category for each month (sometimes zero).
I helped her write a formula to pull the count from the clothing worksheet, for the month of March 2019 into a cell on the summary worksheet:
=COUNTIF($CLOTHING.G3:G502;">2/2019")-COUNTIF($CLOTHING.G3:G502;">=4/2019")
This correctly yields 5. Cool. But that is just one month, and we need twelve for each year, for multiple years, and we have six categories. So we'd rather not hard-code each formula every time we need a count.
When we tried to copy the formula into cells below (for April, May, etc), hoping it would adjust the dates, it wrongly adjusted the cell range to G4:G503. The cell range shouldn't change; the months should advance, but they did not change.
We've been trying different suggestions we found online, such as naming the range G3:G502 but it didn't like that. We got an error.
We both (obviously) have a limited knowledge of Excel. Please let me know what we're doing wrong OR if there is a better way to approach this, and how to do it step by step. Please ask any questions if my explanation is not clear.
Using your formula I would adjust it as follows:
=COUNTIF($CLOTHING.G$3:G$502;">="&DATE(2019;row(1:1);1))-COUNTIF($CLOTHING.G$3:G$502;">"&EOMONTH(DATE(2019;row(1:1);1),0))
Note the addition of the $ to the cell reference. This keeps either the column or row from change when a cell is copied.
Row(1:1) will return 1 in the first cell it it entered into and as it is copied down will increase by 1. Therefore it is important not to copied it down more than 12 rows from its initial entry point.
Note the year in the date is hard coded. Alternatively the year could be placed be place in a cell and a reference to that cell could be used in place of the hard coded year. That way in subsequent years, you would just change the value in the cell instead of changing your value in the hard coded formula.
Note this solution assumes January for the first cell and months following sequentially to December for the 12th cell.
I my system is configured to use , as separators instead of ; so it is possible I may have made a mistake with those in my edits.
Alternatively you could look at COUNTIFS. It is similar to COUNTIF but requires all entries to be TRUE for an entry to be counted.
=COUNTIFS($CLOTHING.G$3:G$502;">="&DATE(2019;row(1:1);1);$CLOTHING.G$3:G$502;">"&EOMONTH(DATE(2019;row(1:1);1),0))
I have an excel sheet with 3 sheets. The second sheet is a list of permutation/combination of employee and the possible shifts they can work and hours they get.
The first sheet has a monthly calendar view. For each calendar day they are select from the list from second sheet
I want the their sheet to display number of total hours each employee is scheduled to worked based on sheet 2 numbers ( column B)
Awesome scheduler ... I made one just like it a couple of years ago but will additional reporting pages that would break down the total hours by standard pay, OT pay, and holiday pay, then with that information calculate their gross pay.
I recreated a basic version of what you have pictured above and then put together two different methods for calculating the total hours per week per employee based on the schedule.
The first way is the simpler way that makes each calculation individually and then totals them on the back end. To do so you will use the 'countif' function for each shift for each person (the range is the whole calendar and the , then multiply by the corresponding number of hours per shift on the 2nd page.
Then in the next column you see I merged the cells next these subtotals, and wrote a 'sum' formula to total the subtotals for each shift totals in column J. This approach is easier to put together and easier to diagnose issues with as you are working on it.
The 2nd method I used is more complicated as it nests these functions into a single operation using the 'sum' and then several iterations of the 'countif' within it.
If you really want to get fancy you could go another step further and put together an array formula, but they are a bit more tricky.
Depending on how meticulous you are about having innocuous data, I added an additional condition on mine that would leave the totals cells blank if someone didn't work, just because I don't like to see the '0' when I was reviewing the back end report.
Hope this helps.
I'm tracking hours for my company and I need to see the updated hours daily. I have everything formatted how I want it, except I want two columns to show how many hours over and under each employees current hours are.
What I have right now is
=(D3-C3)+(F3-E3)+(H3-G3)+(J3-I3)+(L3-K3)+(N3-M3)+(P3-O3)
But it is including all the empty cells (for days that haven't been worked yet) as a zero.
I want a formula that can allow me to ignore those blank cells until they have content.
I can't just use a SUMIF >0 function because I need to count the number of hours employees have MISSED (i.e. scheduled 12 hrs, actually worked 0).
Here's an alternate approach to #Tom's, though it works on similar principles. This one, however, relies on your ability to add a couple of 'HELPER' rows, above your current data.
I'm assuming that row 1 will alternate between saying "PROJECTED", and "ACTUAL".
I'm assuming that row 2 will be dates for that week, in Date format. So A2 will be Jan 1 2015, B2 will be Feb 1 2015, C3 will be Feb 1 2015, or however often the time blocks go up. The key here is that the PROJECTED columns and the ACTUAL columns will each need the date in them.
The formula to check the variance between that row's PROJECTED amount and that row's ACTUAL amount, only for dates prior to today, is (for row 3 and copied down, and assuming the data goes to column Z):
=SUMIFS(A3:Z3,$A$1:$Z$1,"PROJECTED",$A$2:$Z$2,"<"&TODAY())-SUMIFS(A3:Z3,$A$1:$Z$1,"ACTUAL",$A$2:$Z$2,"<"&TODAY())
This checks to see the value of PROJECTED columns for that row, where the date is less than today, and subtracts the value of ACTUAL columns for that row, where the date is less than today.
If you are looking to compare with something other than TODAY(), you can set up a cell to be your 'comparison point'. Manual type the breakoff period you are concerned with into that cell, and replace "&TODAY()" with, say, "&AA1" [assuming your breakoff point is entered in cell AA1].
As it stands, either a very long series of IF's and OR's or an array formula:-
=SUM(IF(OR(D3="",C3=""),0,D3-C3),IF(OR(F3="",E3=""),0,F3-E3),IF(OR(H3="",G3=""),0,H3-G3),IF(OR(J3="",I3=""),0,J3-I3),IF(OR(L3="",K3=""),0,L3-K3),IF(OR(N3="",M3=""),0,N3-M3),IF(OR(P3="",O3=""),0,P3-O3))
=SUM(D3:P3*ISEVEN(COLUMN(D3:P3))*(C3:O3<>""))-SUM(C3:O3*ISODD(COLUMN((C3:O3))*(D3:P3<>"")))
The second one must be entered with CtrlShiftEnter
Note that it could easily be broken by insertion/deletion of columns.
Rewording the question as I've tried the responses (thank you very much for those) but they're not doing what I need.
Master tab has hundreds of candidate records on it from a large range of dates over the last year. I'm interested in 2 columns.
Col A contains the date the candidate took the exam
Col B contains the candidate grade (Distinction, Credit, Referral)
On a new tab, I need to report on how many Distinctions were achieved, how many Credits and how many referrals for last week only
This will need to be repeated each week on a new tab (difficult boss!) so I need to make it as easy to repeat as possible
Please list the grades uniquely (say in ColumnA starting in Row1) then in B1:
=COUNTIFS(Sheet1!A:A,">42005",Sheet1!A:A,"<42012",Sheet1!B:B,A1)
and copy down, where your data is assumed to be in Sheet1. The numbers (42005, 42012) are the numeric representations of the relevant date limits (eg 42005 is what my system shows for 1/1/2015 in Numeric format).
I think this should work. So for column A1 to A6 I check whether the date falls between a certain range. In my case between 7/03/2015 and 19/03/2015. Then I just want to count the items containing DISTINCT/CREDIT/REFERRAL.
=COUNTIFS($A$1:$A$6;"<20/03/2015";$A$1:$A$6;">06/03/2015";$B$1:$B$6;"DISTINCT")
=COUNTIFS($A$1:$A$6;"<20/03/2015";$A$1:$A$6;">06/03/2015";$B$1:$B$6;"CREDIT")
=COUNTIFS($A$1:$A$6;"<20/03/2015";$A$1:$A$6;">06/03/2015";$B$1:$B$6;"REFERRAL")
I am currently using the following formula
=SUM(INDIRECT("'Net "&($A$2)&" "&RIGHT($A48,2)&"'!C4:C21"))
That works out perfectly, but I'm trying to make the range portion of it (C4:C21) dynamic.
The $A$2 that the formula is referencing is something that someone types in and currently says "May". The $A48 that the formula is referencing is simply pulling the last 2 digits of the year.
These are the pieces of the file
There are a total of 6 tabs that are significant. There are 4 tabs that total up prior years sales for a particular month. So I have Net May 11, Net May 10, Net May 09, Net May 08. These are the tabs that the Indirect formula is finding.
The last 2 tabs includes the one where this formula exist in (Net May 12) and the tab that the range will need to be based off of (Cust May 12). In the Cust May 12 tab Column A is the day, column B the day of the Week, and column C is where we have our sales data. Someone goes in every day and types in the sales for the day. So as an example I currently have sales data from 5/1/2012 until 5/18/2012. Everything from 5/19/2012 - 5/31/2012 in column C is blank. The sales data that currently exist are in C4:C21, with C22:C34 being blank. Because I am comparing prior years sales to this years sales they must be comparable, which is why the formula only uses C4:C21 for all of the prior years sales.
I have tried a few things including a CountA and some offsets to try and help me out, but I have been unable to find a solution to making the range dynamic for all of my prior years sales formulas. I need the formula to simply increment to something like C4:C22 for all of the prior years when someone types in the sales data for the next day in the Cust May 12 tab.
Your question is not completely clear, but it sounds like you want something like:
=SUM(OFFSET(INDIRECT("'Net "&($A$2)&" "&RIGHT($A48,2)&"'!C4:C4"),0,0,COUNTA('Cust May 12'!$C$4:$C$34)))
However, you might want to consider restructuring your data to store it in only one worksheet, say with columns like Year, Month, Day, and Sales. Then, questions like, "What were 2011's month to date sales for May," are easier to answer (particularly with the SUMIFS function added in Excel 2007) like this:
=SUMIFS(<Sales column>,<Year column>,2011,<Month column>,"May",<Date column>,"<="&DAY(NOW()))