VBA to find maximum value in a chart - vba

I have a range of data columns A, B, and C. I have displayed as a line graph with B as the primary axis and C as the secondary axis. Column A is the category axis. I want to find the maximum value of column C and put a data callout on the point that is the maximum of column C and where column B occurs.
I know this sounds confusing. In this example, the maximum of Column C occurs at Point 27 (or 1.50% on the category axis). I would like a dot at point 27 for both Column B and C.
Column A is percentage from -5.00 to 10.00 incremented at .25%. Columns B and C are plotted against the change.

In the past I have done something similar, use a formula in column D to identify the largest number in Column C and B and make it a value high on your chart if the result is true.
Add Column D as a series to the chart.
Change the chart type on that series only to a scatter chart or something that puts points up there.
You can put a label on or simply put the amount showing above the plotted point.
You don't need VBA for this.

You might be interested to know I found a solution that works for me. First, I added columns D and E using the formula =IF(C2=MAX(C$2:C$62),C2,NA()) and =IF(C2=MAX(C$2:C$62),B2,NA()), this gave me the point on the graph for both lines B and C where B was maximum. I then formatted the graph so that these points had data callouts (a request from the client). Finally, I set columns D and E to have white font, to match the background so the appear invisible. I don't love this step, but I don't want the client to see the extra rows of #NA, etc.
The basic VBA for data callout is ActiveChart.FullSeriesCollection(5).Select
ActiveChart.SetElement (msoElementDataLabelCallout)
Where the series is 5 (column E) and I'm putting a data callout on the graphed point, which happens to be the maximum of column 3.

Related

Sequence function on existing data

picture of example dataset
I am looking for a function to change the values from 0,1,2,3,4,5,6 etc. to every 5 in R. I have a big dataset similar to column A and B and would like to change it to columns H and I (like shown in the attached picture).
I'd like to change every cm til every 5 cm so that species that covers 5cm or shorter than 5 cm are registered as a point (similar to equ_palu). Moreover, the specie bet_nana covers 0-10 cm and is therefore registered as 5 and 10 in column H and I.

Dendrograms with SciPy

I have a dataset that I shaped according to my needs, the dataframe is as follows:
Index A B C D ..... Z
Date/Time 1 0 0 0,35 ... 1
Date/Time 0,75 1 1 1 1
The total number of rows is 8878
What I try to do is create a time-series dendrogram (Example: Whole A column will be compared to whole B column in whole time).
I am expecting an output like this:
(source: rsc.org)
I tried to construct the linkage matrix with Z = hierarchy.linkage(X, 'ward')
However, when I print the dendrogram, it just shows an empty picture.
There is no problem if a compare every time point with each other and plot, but in that way, the dendrogram becomes way too complicated to observe even in truncated form.
Is there a way to handle the data as a whole time series and compare within columns in SciPy?

How do I extract the coredata of a zoo object into a data frame?

32I have several zoo ordered observations that contain data indexed by date. For example (HTML used for spacing):
A B
2014-10-5 60.272 84.019
2014-10-6 61.183 84.024
2014-10-7 61.611 84.010
A B
2014-10-5 61.376 84.028
2014-10-6 61.761 84.032
2014-10-7 62.210 84.025
A B
2014-10-5 61.159 84.006
2014-10-6 61.550 84.029
2014-10-7 61.996 84.024
I have 3 of these objects, say, x, y, and z, with different data in each.
I want to extract data (from last row) from these and put them into a non-zoo data frame because I no longer want the date indexing. Here is what I tried to do:
main.result <- data.frame(x[nrow(x),])
main.result <- data.frame(rbind(main.result, y[nrow(y),]))
main.result <- data.frame(rbind(main.result, z[nrow(z),]))
What is get is not what I expected in main.result:
A B
main.result 61.61163, 62.21080 84.02096, 84.02505
61.99627 84.02423
I should have gotten:
A B
61.611 84.010
62.210 84.025
61.996 84.024
I want to continue to add rows to the main.result matrix. Where am I jumping the track here?
SOLVED: Sorry, the formatting of the output for ‘main.result’ threw me off. The answer I am getting is correct. Please disregard this post!!

Mark accumulated values on a QlikView column if condition is fulfilled

I have a table in Qlikview with 2 columns:
A B
a 10
b 45
c 30
d 15
Based on this table, I have a formula with full acumulation defined as:
SUM(a)/SUM(TOTAL a)
As a result,
A B D
b 45 45/100=0.45
c 30 75/100=0.75
d 15 90/100=0.90
a 10 100/100=1
My question is. how do I mark in colour the values in column A that have on column D <=0.8)?
The challenge is that D is defined with full accumulation, but if I reference D in a formula, it doesn't consider the full accumulation!
I tried with defining a formula E=if(D>0.8,'Y','N') but this formula doesn't take the visible (accumulated) value for D unfortunately, instead it takes the D with no accumulation. If this worked, I would have tried to hide (not disable) E and reference it from the dimensions column of the table , Text colour option. Any ideas please?? Thanks
You can't get an expression column's value from within a dimension or it's properties, because the expression columns rely on the dimensions provided. It would create an endless loop. Your options are:
Apply your background colour to the expression columns, not the dimensions. This would actually make more sense as the accumulated values would have the colour, not the dimension.
When loading this specific table, have QlikView create a new column that contains the accumulated values of B. This would mean, however, that the order of your chart-table would need to be fixed for the accumulations to make any sense.
Use aggregation to create a temporary table and accumulate the values using RangeSum(). Note this will only accumulate properly if the table is ordered in Ascending order of Column A
=IF(Aggr(RangeSum(Above(Sum(B),0,10)),A)/100>0.8,
rgb(0,0,0),
rgb(255,0,0)
)

Crystal Reports changing sorting with custom logic

I need to sort a demand pick list report by BIN_id, but in an odd logic that I am not sure how to handle through crystal reports. So, bins are going to be [A-J][01-06][01-06], so for example D0306 would be one of the bin numbers.
The warehouse is set up as so (imagine the middle line of this table is where the warehouse workers will be walking).below is the format
A B
C D
E F
G H
What we want them to do is start with the "A" side of the bins, go all they way down to the farthest letter they need (up to G), switch over to the opposite side of the bin they stopped on (so if they only went down to E, they would end up at F and go up and pick from F through B). What I need to do with crystal reports is get BIN ID'S to sort like the examples below:
EDIT: A batch of orders is going to have BIN_ids that can possibly start with A-G. For example a batch of orders might have bins A0102, B0304, G0304, G0106, E0101, C0106, C0205, C0404, D0106, D0202. With this order I would want is sorted as such:
A0102, C0106, C0205, C0404, E0101, G0304, G0106, D0106, D0202, B0304
EDIT: More examples
if only A and B bins exist in the batch of orders:
A bins then B bins
if A bins through F bins exists in the batch:
A then C then E then F then D then B
if C,E,G,D exist in the batch of orders:
C then E then G then D
And so on and so on. Basically we want warehouse workers to make a U shape while they are picking through the warehouse. Start at A, go down to G, switch over to H and go up to B. This logic isn't complicated, I just have no idea how to go about doing it in Crystal...
Thanks your you help everyone, let me know if something doesn't make sense.
Your explanation is very confusing!!!!
After reading multiple times I understood you want to sort the report in the way you wish to and my solution will be according to this.
You need to manually apply sorting on the filed that is obtained from database so the solution should be:
Group the report according to the required field now when insert group window is appeared then go to tab "Group in Specefied order" and at that tab set the way you want to view the report.
If I am totally out of your problem.. Explain clearly will try to help.