Excel graph using stacks - excel

I need to develop a stacked graph based on time intervals:
Basically I have 10 different time intervals and I want to display all the values that I have stacked on this time interval, for example:
Dataset example to plot the graph:
Time interval - Name of the group - Number of jobs
2 minutes Group A 5
2 minutes Group B 10
2 minutes Group C 15
4 minutes Group A 10
4 minutes Group D 5
6 minutes Group B 25
6 minutes .. ..
6 minutes
8 minutes
10 minutes
10 minutes
10 minutes .. ..
10 minutes Group A 10
So basically I want my X axis as the time interval (2,4,6 minutes..)
And on each bar of the time interval I want to stack the group values with a legend for the name of each group.
So on time interval of 2 minutes I would like to have a total stacked bar with value 30 (5+10+15) and this bar would need 3 different colors for each group inside (Groups A,B and C)
Is it clear?
Thank you so much for the help!

You will want To rearrange your data like this:
You can then easily generate a stacked column chart:

First of all, you'll need to organize you data in a matrix where the colums' titles are the groups and the rows' titles are the time interval values.
For that, you can use Pivot Table.
select all the data cells (including thetitles in the first line).
click the Add tab, click PivotTable.
Choose Where to place the Pivot Table(I prefer in the same sheet,
but when there's a lot of data it might be better to place it in a
new sheet).
in the left panel "PivotTable fields", drag "Time Interval" into
"columuns", "Name of the Group" into "rows" and "Number of jobs"
into "values".
because pivot table is acctually used for counting and summing, in
addition to the matrix there will be grand total values which you
can (and should) remove by right click on "Grand Total" and then
"remove Grand Total" (you acctually should do it twice, one for the
row grand total and one for the column grand total).
There might be other annoying titles such as "Sum of Number of jobs"
and "column titles", don't worry you can edit those title cells like
any other cell.
finally, select all the data in the matrix (include the groups'
names and the time intervals), click the Add tab and click the bars
chart icon and click the stacked bars chart icon.
Done!
let me know if this solved your problem or if misunderstood the problem right.
Good Luck!

Related

How to change columns in a plot with shortcuts

I am working on Microsoft Excel 2013 scatter plots and I'd like to know if there is a more productive way to do this:
Let's say I have a big database with several columns and rows, i.e:
A B C D
1 Length Width Volume Area
2 2 1 8 4
3 3 2 7 1
4 1 5 3 5
5 7 3 12 6
I create a scatter plot for Volume vs Length. After, I want to create another scatter plot for Area vs Width. As I have a lot of rows and columns, I copy the first plot and then, in select data, I change the range of data (A to B and C to D). Is there an efficient way to do this? (shortcuts with arrows keys, maybe? I didn't find them) or Do I have to change the letters manually?
Thank you.
J.
If this is a repetitive task in the sense that every say Friday you create the same 4 graphs based on new information in the same columns then you could record a macro of what you are doing and associate it with keyboard short cuts.
You can do the same thing with updating the graph information but it starts getting a little more complex when you start changing which column number you want as the series. But its definitely possible. I would recommend recording a macro of you editing the 2-3 graphs so we can sheet patterns and we can probably help you edit the macro.
Now something simpler that may, and I stress may, suit your needs. Select A1 to D5, then insert you XY scatter plot. You X axis which should be common to all needs to be in the left most column. When you go to edit your source data you should see each series listed. You can simply check and uncheck which series you would like to have active. the ones with a check mark will display. If you needed three graphs at the same time, you could then copy and paste the graphs twice and set up each one to your desire without having to reselect the data range, you would just check/uncheck which series to display

Creating bar graph of event occurrences for each month of several years in excel

I have a long list of dates (about 2000) in an excel spreadsheet and I want to see how many of these dates lie within particular years (and roughly which part of the year also if possible). I know how to make basic graphs in excel, but I'm not sure how to make a bar graph that uses dates. Any suggestions?
I can obviously split events in day, month, and year and then use count to count the amount of each year, but this would not show the placement of the event within the year in the final graph.
20/03/2000
2/04/2000
3/04/2000
26/05/2000
7/06/2000
20/06/2000
22/06/2000
10/07/2000
12/07/2000
22/07/2000
2/08/2000
8/08/2000
11/08/2000
14/08/2000
15/08/2000
12/09/2000
15/09/2000
20/09/2000
25/09/2000
2/10/2000
22/10/2000
24/10/2000
25/10/2000
27/10/2000
1/11/2000
10/11/2000
13/11/2000
16/11/2000
18/11/2000
20/11/2000
25/11/2000
27/11/2000
3/12/2000
6/12/2000
20/12/2000
21/12/2000
22/12/2000
4/01/2001
7/01/2001
11/01/2001
24/01/2001
25/01/2001
2/02/2001
4/02/2001
9/02/2001
12/02/2001
13/02/2001
20/02/2001
21/02/2001
2/03/2001
11/04/2001
19/04/2001
20/04/2001
21/04/2001
24/04/2001
27/04/2001
28/04/2001
2/05/2001
3/05/2001
5/05/2001
12/05/2001
13/06/2001
20/06/2001
25/06/2001
3/07/2001
5/07/2001
18/07/2001
20/07/2001
21/07/2001
22/07/2001
25/07/2001
4/08/2001
5/08/2001
9/08/2001
10/08/2001
11/08/2001
12/08/2001
13/08/2001
31/08/2001
11/09/2001
12/09/2001
17/09/2001
3/10/2001
10/10/2001
18/10/2001
21/10/2001
23/10/2001
4/11/2001
5/11/2001
17/11/2001
22/11/2001
23/11/2001
27/11/2001
29/11/2001
3/12/2001
I cannot check this in earlier versions of Excel, but in Excel 2016, if you build a Pivot Table with your data and drop the date in the Rows - you get your data grouped in Years, Quarters, and Months. If you also drop the date into Values, then you get the Count of values in each year, quarter, and month.
Then a pivot chart looks like this ...
A less magical way to do it
Applies to Excel 2013 and up
From your single column of dates, build a pivot table.
Put the date in Rows. Put Count of date in Values.
Select any one of the dates. Right Click and choose "Group...", or choose "Group Selection" from the Analyze ribbon.
Click on each of Months, Quarters, and Years.
Filter how you would like.
Select PivotChart from the Analyze Ribbon.
You can create a scatter graph as suggested in the comment. Consider your data set and see if there is any other quality that could be added to the chart, which could be plotted on the value axis. For example the number of people attending the event, or the duration of the event in seconds, or something like that, so that the graph contains more information. In the following screenshot, the blue dots are just the 1's from column B plotted on the time line. The orange dots plot another data aspect on the vertical axis.
If you create a pivot table of the dates and drag the date into the Sums area you will get a count of each day, make sure this is sorted. Then a chart will show the number of records for each day. You will need to copy and past values from the pivot to a new sheet to be able to make a scatter diagram from the output of the pivot table (in Excel 2010). But once it is a scatter diagram the events will be in the "correct" places.
If you wanted to group it by month instead you could use a formula to create a column of year & month and then do the pivot and chart on that column. For example the formula below will give you 201605 for May 2016.
=YEAR(A2)&RIGHT(100+MONTH(A2),2)
Weeks would be a bit trickier, but I suppose you could divide the date by seven and then INT it to get a 7 day grouping. These wont show the actual events occurance within the period but would let you see which periods have the most events.If you are looking for things like more events at the beginning of the month or something you might need to try different "groupings" like weekly.

10 millisecond data - need to group in 15 minute blocks and apply log average to each block

I have a set of data taken at 10 millisecond intervals. I need to group this data into 15 minute blocks (9,000 milliseconds) and obtain the log average from one column and the 10th lowest percentile from the other (my data is in decibels).
Is there a way I can split the data every 9,000th row and form groups from this, and then apply a formula to each group - without having to repeat the process for each group? i.e. some way to set it up so I can just drag down results (I have two weeks of data.)
To calculate average of rows 1-9000 in column A you can use following formula:
=AVERAGE(INDEX(A:A,(ROWS($1:1)-1)*9000+1):INDEX(A:A,(ROWS($1:1))*9000))
If you drag it down, next one will calculate rows 9001-18000 and so on.

Grouped barplot in excel

Been looking for an answer to this question but as I found nothing I ask it here in hope of getting an answer. This is probably easy for most people.
I got three columns in excel where the first column has the values 1 OR 2 and the second column has the values 1 OR 2 and on the third column are reaction times for each subject (one row is a subject). So a subject can be either 1 or 2 on first column, either 1 or 2 on second column, and then their reaction time.
I want to do a clustered column plot. In the Y-axis I would like to have the third column (its reaction time in milliseconds). On the X-axis I would like to have two groups (take column one, where one group is 1 and the other is 2. Each group (1 and 2) will further be divided into two groups (second column, values 1 and 2). Those could be symbolized as two different colored bars within the two groups of the x-axis (what this second split reflects could be shown on a legend as color red and blue). If I mark all values and press "clustered column", the result is weird. And working with the stuff within the "select" button is like reading hieroglyphs.
(Unfortunately, I could not write how my data looks like because all numbers appears next to each other instead of having them as three columns.)
Look into pivot Tables and get a chart from that.
1) select the table data(have headers for Group 1, Group2, and Reaction)
2) Insert--> Pivotchart
3) Put Group1 into the Axis fields
4) Put Group2 into the Axis fields below Group1
5) Put Reaction into the Values box.
6) Reaction will likely appear as Sum, so click Reaction and 'Value Field Settings'
7) Change to Average(I presume you want an average of reaction times...)
8) Play around with right-clicking the various areas of the chart to learn about formatting the chart...

Display continuous dates in Pivot Chart

I have a set of data in a pivot table with date times and events. I've made a pivot chart with this data, and grouped the data by day and year, then display a count of events for each day. So, my horizontal axis goes from 19 March 2007 to 11 May 2010, and my vertical axis is numeric, going from zero to 140.
For some days, I have zero events. These days don't seem to be shown on the horizontal axis, so 2008 is narrower than 2009.
How do I display a count of zero for days with no events?
I'd like my horizontal axis to be continuous, so that it does not miss any days, and every month ends up taking up the same amount of horizontal space.
(This question is similar to the unanswered question here, but I'd rather not generate a table of all the days in the last x number of years just to get a smooth plot!)
What Douglas said pointed me in the right direction, but what I did was in the pivot table, right=-click on a date, and clicked on field settings, layout and print, and checked "show items with no data". This is in Excel '07, btw.
Select an cell in the data series, on the Pivot Table Options tab, click on Setting for this field, click on the second tab, Layout, then check the "Show labels for missing data" option. This seems to do the job - to the extent of including a Feb 29 for every year. Need to investigate that one some more.

Resources