Summation of entries with the same date in Excel - excel

I have two columns with data (several thousand rows), one with dates and one with duration (time in hh:ss). However, there's multiple records for each day. Is there any way to add these together based on the date and get one entry per day with the summed value?
Below is a picture showing a subset of my Spreadsheet:

I think what could be very useful to you would be the Consolidate function.
If you click on the Data tab on the menu bar, on the mid-right side is a button called consolidate.
Steps to Success:
Select a range beside your existing values, if you photo is the same I would suggest highlighting all of columns C, and D.
With the columns highlighted press the Consolidate button.
Within consolidate choose Sum for the function, and highlight the data in columns A, and B for the reference.
Make sure to check off Left column in Use Labels In
With dates properly formatted as dates, and times properly formatted as times this should sum all of the times given for a particular date. Test trials were successful.
Let me know if that works for you, commetn if you have any questions.

Related

Make excel filter and actualize automatically

I have two sheets, one with a dashboard and another one with the data I need.
In data sheet: So many lines, that I filter by date. I need to know in Weeks, every record that contains in that, for example: I need to know how many records do I have in Week 43 (18-24 OCT). For that, I manually apply a filter and I count the number of records.
In dashboard sheet: I show the number of registers I got in the datasheet.
I want to automatize all this process, I want to do a formula in the dashboard sheet that can filter and show automatically the number of records I got in week X, excluding some variables I have in another column. The column I need contains letters and numbers, random (I need to sum these records, separated by date in weeks). All that I don't need to filter, what I need to exclude from my search starts with AWBXXX (random numbers too).
Example here:
What I need to filter, in green. What I don't need, red.
Please, help! :D

Generate summary gantt chart from detailed activities

I want to create a gantt chart summary that shows a person´s whole "busy" and "free" schedule by day and in a single row, from a detailed gantt chart with a list of activities of different people in multiple rows.
Basically go from this:
To this: (which I created Manually)
To be able to give a summary of people´s shifts free time between activities.
Right now I´m just using this formula to compare the start and end date in each row and produce a "1" if the condition is True, then I just condition formatted the whole Gantt cells.
=IF(AND(Q$8>=$N12,DAY($K12)<>DAY($J12)),1,IF(AND(Q$8>=$N12-0.00001,Q$8<$O12-0.00001),1,""))
I have no idea how to start. I was thinking of doing the nest things:
Create a table of the names of all the possible people to be added in the gantt chart.
Program the macro to create a new sheet with the same template.
Program a loop which starts iterating with each person´s name:
For each person´s name which exists in the gantt chart to be summarized, start creating new rows per each day they have activities scheduled (I can´t figure out yet how I´d iterate through this).
Within the each person´s loop, start iterating each row on the original sheet, evaluating each start and end date´s and pasting on the new sheet´s current person´s current day row a "1" if the condition was true in the corresponding hours.
Loop until all individual activities of each person are finished.
Continue with next person.
I´d like to know if this is the logical way to go and if you have any pointers or similar code to recycle, I am not proficient in VBA and Excel macros.
Not sure if I understand properly, but it looks like you got a set of multiple records where you store the times In and Out of each worker, several rows for each worker.
And based on that, you would like to resume data, one row per worker, highlighting start and end time of each worker, but all in a single row.
I made a fake dataset like this:
I added 2 extra columns (you can even hide them if you don't want to see them)
Field START TIME got this formula:=B2-INT(B2)
Field END TIME got this formula: =C2-INT(C2)
In Excel, Dates are integers values and times are decimal values. I used both formulas to get only the decimal part of each start and end.
All this data is a table object named T_WORKERTIMES. I made a table object so if you add new records, the Gant Chart will autoupdate.
Then I made a simple (kind of horrible) Gant Chart:
The formula I've used in H2 and drag is:
=COUNTIFS(T_WORKERTIMES[Worker];$G2;T_WORKERTIMES[start time];"<="&H$1;T_WORKERTIMES[end time];">="&H$1)
Actually, all my data is in same sheet:
I added 2 Conditional Formating Rules to highlight cells in green/white if the result of the formula is 1/0.
Also, working with times sometimes can be hard, because decimals. 0,677083333335759 means 16:15. But 0,6770833333333333 too, so in Gant Chart I rounded up headers to 6 decimals.
My formula in H1 is =ROUND(7/24;6)
My formula in J1 and drag to right is =ROUND(H1+1/24/4;6)
So now everything works fine. Please, notice in worker 1, there is no activites from 07:00 to 08:00. So I add a new row with that data and everything updates:
I've uploaded a sample yo Google Drive you can see the formulas and hope you can adapt this to your needs.
https://drive.google.com/file/d/1KOuCAYsmlY9gfNUCUhIrihXu-tJz-K7t/view?usp=sharing
Biggest issue here is the decimal part of times, to make sure they fit the Gant Chart. An easy solution would be substracting just 1 minute to start time column (calculated, you can hide it) and sum 1 minute to end time column (calculated, you can hide it).
Hope this can guide you in your project.
It looks like you are trying to extract unique records per person and day to get a person/day summary of time availability but also want it to be automated as you add more people and days.
I was able to do this with a combination of powerquery and a pivot table. When new persons/dates are added or changed the report will update but you will need to refresh using CTRL+ALT+F5
you want to highlight your entire report or an area as big as you think it will get. While highlighted you will then utilize named range feature under FORMULAS tab -> DEFINED NAMES ribbon -> DEFINED NAME dropdown. We could name it REPORTAREA or something like that.
Make sure you change the conditional format formula in report to show 0 instead of "" so this can work properly
2 go to DATA tab -> GET AND TRANSFORM ribbon -> From other sources -> Blank Query.
This will open the power query editor as a blank query
3 In the formula bar type =Excel.CurrentWorkbook() case sensitive is important
4 From there you will see CONTENT and NAME column.
In the NAME Column select the drop down and go to TEXT FILTERS -> Equals... Type in the name of your named range so the query does not pick up anything else on accident.
5 Remove the NAME column by right click selecting it and then remove.
6 you will notice the CONTENT column has two curved arrows pointing left and right instead of straight down like you are used to in excel. Click these arrows and make sure you uncheck the "use original column name as prefix" option box and ensure that the EXPAND option is selected. Then click okay.
7 At this point it looks alot like your report. Go to the HOME tab -> TRANSFORM ribbon -> Use first row as headers.
8.Select only the columns that are NOT THE 24 hr STYLE TIME LABELS of your report and then right click -> Unpivot other columns
9 At this point you can start removing some of the columns you dont want by right click and remove. Also double click and rename the columns as you wish. You can right click the top of the column and change types to what you want.
Dont worry about the 24HR style time zones not looking correct as this will be fixed later, this column should be changed to decimal type and not time zone type.
select a column that has the date information you need and right click -> Duplicate column -> change type to date.
11.At the top left part of the screen there is a CLOSE AND LOAD drop down where you will load to a new worksheet.
That will produce a green table. Select the table and press ALT+D+P to produce a pivot table linked to the green table you produced from the query.
You may need to close the Queries and Connections box that opened in order to see the pivot table options that will appear on you right.
Drag the 24hr style column to the columns area.
Drag the People to the Rows area and after Drag the Column you made in step 10 to the Rows area.
Drag the conditional format column to the Values area.
Your pivot table wont look exactly like what you want. while pivot table is selected go to DESIGN tab -> REPORT LAYOUT -> Tabular and also SUBTOTALS -> DO NOT SHOW SUBTOTALS while in the same tab.
13 Highlight all of the 24hr style time labels and format them and after highlight the inside of the pivot table where all the 1 and 0 will be and apply the conditional formatting you applied previously. Dont forget you changed the formula originally so your if statement does not end with "" but instead with 0.
If you would like i think it is easier to switch around the ROWS and COLUMNS area of the pivot table fields so that the report is easier to read. I have chosen to do so in the pictures. If you want to keep the report the way you are used to you can follow previous instructions.
I put the above comment down here as a complete answer.
I call those cells after "Finish date" column as "Chart cells". To extract a unique list of names, please refers to: here
If each name, you can use the followings formula and format for cells value >0 to show the bars.
=SUMIF([name range], "[each name]", [for each column of the chart cells])
If you further needs to filter by dates, you need to use sumifs() instead:
=SUMIFS([each column of chart cells], [name range], [unique name obtained from above], [Finish date range],"<=" & DATEVALUE("[target date]")+1,[start date range],"<=" & DATEVALUE("[target date]"))
This is the Excel formula solution, which is good if your table is not huge.

Argument to find data in large Excel document to later use with other data found

I have a very large Excel document with something like 7500 rows. Not all of the data is needed, but I want to use some of the data to find how long an order takes from start to end (lead time).
I tried starting with the INDEX function to find and out put individual order numbers based on another cells data ("Order has Shipped"). This formula worked, however it only returns the very first Order Number and no others.
My thought here was that I could do one column that pulled all the order numbers based on the "Order has Shipped" requirement. After that, I would do a similar function to give a second column next to the order numbers that showed the correct data and time stamps. After that, I would do two more columns with basically the same information, but to show when the order was first entered and spit out another time stamp. From these two time stamps, I could do a simple function to calculate the difference in time.
I wanted to put these into new columns so I could also find the average lead time, number of orders shipped, and other things.
=INDEX(D:D,MATCH(L11,G:G,0))
Any help would be greatly appreciated.
Try using =IF(L1="Order has Shipped",D1,"") to get the Order Numbers and then you can "Find & Select" and click "Go to Special", then click blanks. This will select all the blank values. Then click delete and it will get rid of all the spaces in the rows so you have all the unique order numbers that have been shipped listed in one column.

Calculate average of values in a column based on matches of two variables in two other columns

I'm having an issue with some data that I'm working on that has had me stuck for a while.
I'm working on some patient data for a clinical practice that has each patient encounter logged on a separate line with an account ID, date of service, the height and weight measurements for that date, and other variables.
Aside from VLOOKUP and the usual formulae/functions I've got a pretty rudimentary understanding of Excel but I can pick up on things fairly quickly.
In the data I've got each line tied to a patient account ID as well as what quarter the DOS was in. For patients with multiple visits, they will be identifiable by repetitions of the account ID number on other lines.
For some patients, there will also be repetitions in the quarter if the same patient was seen twice in the same quarter. This is where I need help.
I'd simply like to average the value of a variable for each patient in each quarter. I'm not sure if AVERAGEIFS is the right function to use but I need an operation that checks for matches in a line of both account ID and quarter (Q1, Q2, Q3, or Q4) with the other lines in the sheet and comes up with a quarterly average for the variables in question.
What I have
What I need
If I'm understanding your question, you could use AVERAGEIFS to accomplish what you are asking. With excel, a lot of how successful an approach will be is determined by how your data is structured, and if/how often you are planning on updating your work.
It would be easier to give a concrete answer with an example of the data you are looking at.
If your source data is in columns A:D something like:
and you are looking to summarize the weight data in I by account ID and Quarter:
you could use AVERAGEIFS(C:C,A:A,G2,B:B,H2) this would find the cells in column A that match the value in G2, find the cells in column B that match the value in H2, and report the mean value in column C of the matching rows.
An alternative is to use a pivot table, which automates a lot of what you are trying to do. For that approach you would select your data block, and click on Insert>>Insert Pivot Table (at least in my version). That should bring up a wizard. Accepting the defaults will create a new sheet. Then look on the right side of your window, and you should see a list of your column names near the top, and four boxes called Filters, Columns, Rows, and Values. You should be able to drag and drop your columns into these boxes to get summaries of your data. If you add your Account ID and Quarter tabs as columns, and your height and weight as Values, then right click on each of the value columns and select "Value Field Settings" and select Average from the menu that pops up. That should give you something that looks like:
At that point, you can change the formatting to make if fit your needs, or copy data somewhere else.
The AVERAGEIFS approach will automatically update if you add more data, but will only summarize things that match the values you list. If there is an account ID/Quarter pair that isn't in the summary column you won't have any idea it's there. If you are summarizing an ID/Quarter pair that isn't in your data you'll end up with a division by Zero error like in the example.
The Pivot Table option only updates when you manually click refresh (right click and choose refresh pivot table from the menu), but will summarize all the data based on the columns you've selected. It's also a little more robust as you avoid having to type out the formulas and make sure you are pointing to the right column. This option also by default provides nested summaries; you can turn the subtotals and grand totals off if you want.
I used the function:
=SUMPRODUCT(($B$2:$B$13="Customer 1")*($C$2:$C$13="Q1"))
Where Customer 1 could be a user id and Q1 you can change to which quarter you want.
Excel screenshot

How to display rows that contain data present in several columns (Excel and/or Google Spreadsheet)

I've been searching for a solution to my problem for days and haven't had any luck. Maybe I simply can't manage to search for the right wording for this problem but hopefully somebody will understand me here.
I'm having difficulties displaying data that is present in several columns at the same time, in my case the data to be displayed are trading days for various stocks. As the trading days vary between stocks I would like to have a column that displays the dates present in all other columns to only see trading days in common for all stocks.
I apologize if I'm unclear as this is my first question here. If anyone could point me in the right direction I would greatly appreciate it.
Here's the google spreadsheet link so you can see what I mean by different amount of trading days. The idea is to have column A display dates which are present in columns B,F,J,N,R,V at the same time but not show the other ones.
https://docs.google.com/spreadsheets/d/19GsIAtEdWPGcBfNOPaeqNVB7QQNO-bOyg-dCZzDaGkQ/edit?usp=sharing
EDIT: To show the desired output I'm looking for, here's another example:
https://docs.google.com/spreadsheets/d/1jrIqaEzDPWcW4hkF2YdHq9XYIWjG8PhrewYrBHqEdVY/edit?usp=sharing
The dates are automatically pulled from google finance. As the various exchanges are open on different dates, each stock has a varying amount of open days in columns B-E.
What I'm trying to do is have a formula in Column A that checks all the other columns and returns the data (in this case the date) that appears in every other column, discarding the data that doesn't appear in all other columns. For example 3/9/2013 appears in all columns B-E therefore it is shown, however 12/09/2013 doesn't appear in column B therefore it isn't shown.
Cheers
your dates are in european (UK) style, ie: 31/12/2014 but your spreadsheet is saved as US standard. This will cause some dates to be stored as text, as they are considered invalid. Ti will also couse unexpected results if you try to do any calculations or comparisons using your data. Go to File -> Spreadsheet settings and under locale choose correct country.
Then select all date columns, and click format->number->date or click the 123v button on tool bar, and choose date.
to simplify your problem:
for a value to be repeated across all 6 columns, that value must appear in column B.
you therefore want column A to contain the value of the adjacent cell in column B, if that value also appears anywhere in column F,J,N,R and V.
to check if value of B4 appears in column F you can use COUNTIF function. If the result if >0, than value of B4 appears in column F. Repeat for all columns and combine to achieve the following formula (to go in cell A4) :
=if(countif(F:F,B4)*countif(J:J,B4)*countif(N:N,B4)*countif(R:R,B4)*countif(V:V,B4),B4,)
now copy this formula down, and only dates that appear in all columns will be displayed in column A.
Use IF and COUNTIF. I think this is what you are looking for.
IF(COUNTIF(B4:V4,B4)=6,B4,NA())

Resources