Bar chart with first each month while having different durations - excel

After publishing a too broad question in the first place, I want to ask for a second time – more problem-focused.
The shown bar chart is needed for a broad variety of projects and will be used for 6 month projects as well as for 3 year projects.
But it will be forwarded – so it should look professional.
For this reason I want to change the dates on the x-axis to the first of every month. For a fixed period of time, I would be able to do so. But for a broad variety of durations, it’ll have to have some vba code in the background – and that’s where I’m dipping in the dark. All my testing with start and end date didn’t work out. There’s too much variety in these numbers.
I’ll show the vba of the chart down below. It’s just recorded and has no special tricks inside.
Is there a way, to get there? With calculation between start and end date, I didn’t get a reliable result for first of each month for a random time period.
Thanks for your help! <3
Sub testStackoverflow()
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlBarStacked
ActiveChart.SetSourceData Source:=Range("testStckoverflow!$A$86:$B$96")
ActiveChart.Legend.Select
Selection.Delete
ActiveSheet.ChartObjects("Diagramm 3").Activate
ActiveChart.ChartTitle.Select
Selection.Delete
End Sub

I think you can just use a 2D horizontal stacked bar chart.
Set the start of the chart's x-axis as the first day of the earliest month that appears in the project schedule.
Series 1 for each task is the difference between the task start date and the date which starts the chart's x-axis. This allows you to show tasks which don't all start at the same date. Set the bar portion for this series to transparent.
Series 2 for each task is the task duration in days. This portion of each bar should be set to be visible.
Format the X-axis of the chart to Category: Date, Type: Month-Year. This will set each tick to the first day of each month.
Formatted bar chart

Related

Excel 2016 VBA Display every nth Data Label on Chart

I have a line chart that displays the revenue of multiple airlines, throughout the period of 2011 to 2016 - with data points plotted quarterly (Q1-Q4, for each year) on the X-axis
I would like to only show the data labels (on the chart) for Q4 of each year, for each airline. I would like to do this and keep the axis as is.
Any suggestions will be much appreciated,
Thank you!
(I have Excel 2016)
Your question didn't express clearly if you want to add the labels by means of a VBA macro.
I suggest to do following:
Dim sData as Series
For i = 1 to sData.Points.Count Step 4
sData.Points(i).ApplyDataLabels
Next i
Note that if there is not value for the Point i in the series, the label seems not to be displayed. It took a while to find out why a label was not added to the chart. To detect this case, I wrote following test:
If sData.Points(i).HasDataLabel Then
If Len(sData.Points(i).DataLabel.Text) = 0 Then
...
End If
End IF
Searching a little in the web (around 3 minutes, that maybe you should spend the same time) found this article:
http://www.cs.mun.ca/~n39smm/Excel/Data%20Label.pdf
This is the resume, but I suggest to view the document because have a lot of graphics.
Click on the bar you want to labeled twice before Add Data Labels.
Click on the label, then right click and select Format Data Labels.
Check the Category Name and uncheck Value.
A little research before asking can save you a lot of time.

Determining the optimal excel chart major unit

one of my tasks is updating a presentation with zillion charts.
Since there are 4 charts per slide it is important that the major unit on a chart is set so that the charts are legible.
I found a way to code some steps and cut the time significantly but one of the missing pieces is determining the major unit of a chart.
So the question is:
Is there a way to to determine through formulas or vba what should be the major unit in a date type x axis based on the dynamic start date and end date (I want last date to be shown on a graph)
Bellow is the example:
dates are having one week interval
I need the final date that shows up in pivot to be on the chart
I need the chart dates to be legible given that it will take quarter of a slide
chart example
I tried going through similar questions and one of the solutions (that didnt work for me) was:
using Days360 to calculate number of days between start and end date
adding 1 to be inclusive of start and end day
dividing that number of days with number of wanted ticks minus one
so far I was using 27 as a number of ticks, based on legibility experience
If I find a way to precisely determine a number to be used I will use it as a reference # for my macro that changes all the applicable charts
Could anyone help me out please?

Excel 2013 time & days schedule overlaps

Without using VB, in Excel 2013 how can I look for schedule overlaps for instructors --they can't teach 2 classes at same time on same day.
Example: ** These 2 are a problem and need to stand out as an error.
Course Title Time Days
Human Implications I 1:30pm-3:30pm M/W
Principles of Biology 3:30pm-5:30pm W
**Principles of Biology 9:30am-10:45am M/W**
**Principles of Human I 9:30am-10:45am M/W**
Genetics 9:10am-10:45am T/R/F
You may want to look into SUMPRODUCT. Select your whole table and then add a new conditional formatting rule. Choose "Use a formula" and try this. Then change the "Format" to color the cells when they match. I did have to change your format as I could not figure a way for excel to determine the times and days when they are all in one cell. This is the format I used. I started the table on cell C2.
Class Title Start Time End Time Day1 Day2 Day3
Principles of Bio 9:30 am 10:45 am M W
=SUMPRODUCT(($D$3:$D$7<=$E3)*($E$3:$E$7>=$D3)*($F$3:$F$7=$F3)*($G$3:$G$7=$G3)*($H$3:$H$7=$H3))>1=TRUE
This works by checking if the start time is before the other classes end times, the end time is after the start time, and the days are the same. Give it a try.

Plotting multiple time durations in Excel

I want to plot a graph in excel which has x-axis values as times(just of one day, this will be plotted everyday) and y-axis values as different applications. Suppose an application A runs jobs from 1:00 pm to 2:00 pm and then from 4:00 pm to 6:00 pm. Is there a way I can plot these time durations for each application?
I am visualizing a graph where an application has a colored bar next to it for the time period 1pm to 2pm and then it is blank until 4pm where another colored bar appears till 6pm.
Is this possible? I have the start and end times of jobs for each application. Differentiating between jobs is not important. I just need to know when the application is running and when it is idle.
Any help would be appreciated! Thanks
A little example:
The data is a label in ColumnA (for the y-axis) and 'readings' (here in B1:G1). The 'readings' are the length of the static intervals (in hours). 0 because the day has changed, then 13 because nothing happens until 1p.m., 1 because busy 1-2 p.m. - and so on.
If charted with Insert Stacked Bar the default will be to colour fill each range (interval) with a different colour. For the image, the colour for alternate 'series' has been set to match the background and one of the remaining set to match the other.
I admit changing the fill manually could get tedious if required daily for many apps but there is always VBA! And with a small fudge you may be able to 'recycle' (ie use the chart as a template and just overwrite "yesterday's" data.

How to get an Excel graph show "up to" current day of week

In Mac Excel 2011 I have a Scrum burndown chart that tracks the number of points ‘burnt’ per day (starting from say 100, hopefully burning down to 0).
The number of points per day is made up of a sum of X number of columns (tasks).
I then have a marked line graph which takes it’s Y value data from the summed points per day.
My issue is that the marked line graph will always display 5 work days worth of burn, even though we might be on Tuesday.
I need a solution that means I don’t have to manually update the graph y value each day (adding it), instead the graph knows it is Wednesday, and selects data up to Wednesday.
Do you want to show the days for the whole week? (probably, since a 1 or 2 day chart early in the week will look funny.) Are the Y values linked from another cell?
If so, change your links from
=A1
to
=IF(LEN(A1)=0,NA(),A1)
NA() produces #N/A in the cell, which isn't plotted.

Resources