I wasn't successful in finding a solution to my question by googling it, so i hope here there are experts that can help.
I just have one set of data over time (the number of actions per date, so for one month, two columns and 30 rows). I am using a clustered column chart to visualize that data, and have placed a trendline on it.
I would like to change the color of the trendline dynamicaly, to RED if it it descending, or GREEN if ascending. That's it.
Whatever option I tried in Excel 2013, I haven't found the solution, and programmaticaly, I am too "dummy".
I have an approach that skips the built-in trendline. You calculate your own slope, intercept, and correlation, plot your own trendline(s), and use your own formula in the chart. In fact, you have two lines to go with your columns, one that appears if the slope is positive and the other if the slope is negative.
Here's how:
In the screenshot above I have your data in columns A and B. I calculate some statistics as follows:
cell G2: =SLOPE(B2:B12,ROW(B2:B12))
cell G3: =INTERCEPT(B2:B12,ROW(B2:B12))
cell G4: =CORREL(B2:B12,ROW(B2:B12))
I generate the formula in cell G6:
="Y = "&TEXT(G3,"0.0000")&" + "&TEXT(G2,"0.0000")&" * X"&CHAR(10)&"R² = "&TEXT(G4^2,"0.0000")
The superscript "²" is inserted by holding Alt while typing 0178 on the numeric keypad. "0.0000" is the format I'm using to display the cell values in the formula; without using the TEXT function, you'll get something with way too many digits to be useful.
The formulas in C2 and D2 (copied down the column as needed) are:
cell C2: =IF($G$2>0,$G$3+$G$2*ROW(),NA())
cell D2: =IF($G$2<0,$G$3+$G$2*ROW(),NA())
Because of the IF and the NA(), you get values only in one column and #N/A errors (which won't plot in a line chart) in the other, depending on slope.
Create a clustered column chart using all four columns, then change the chart type of the two trend series to line chart. Format the columns and lines as desired.
Select the title by its border, so the cursor isn't in the text of the title. Type =, then click on the cell with the formula. This link will cause the title to update if the formula changes. Change the title text size from huge to something reasonable.
Delete the legend if desired. In this case it really isn't needed.
Related
use the following function to create an invoice.
=VSTACK(FILTER(PerformedTestsTable9,PerformedTestsTable9[Qty]>0,), {"","","Total sum to be paid:"})
Very simple, filtered table for Qty > 1 plus added row with VSTACK.
I use conditional formatting rules to format every other row, blank cells and the last row.
However every time I change something in the source table I get "Total sum to be paid:" left aligned in the bottom right cell. If I right align it manually it does not spill into adjacent left cell because it is not blank.
I can not add the borders I want, I can not change the font, I can not change the size of the font.
What I want is something like this:
Is there a way to achieve those results, even partially, without resorting to programming.
In pseudo-code
On Calculate
Turn off Manual Calculation
Unmerge cells that cause SPILL error in FILTER function
Reset formatting in the spill range of filter function to baseline
Calculate filter function
Identify bottom row and merge cells, right align merged cells, choose bigger font, add borders
I'm trying to randomly highlight (change the cell colour) of four cells in the first Excel column. It is important the selections highlighted are only cells containing data as the size of the data set will vary.
The highlighted selections needs to be un-highlighted when the macro is run again to generate four new selections.
I have tried to brute force this with functions (RAND-RANK-XLOOKUP), but the outcome is messy and doesn't react to different sizes of data.
Highlighting the cells in a color is the goal, conditional formatting could be suitable.
Four random cells from the first column of the Excel sheet is the target (cells only containing data).
Using Conditional Formatting
Let's say you have data in column A. For example 16 rows like this:
You could use the COUNT() function to calculate the number of cells with content in column A in cell D1 :
=COUNT(A:A)
And then you could calculate the position of the cells you want to highlight with
=RANDBETWEEN(1,$D$1)
Then you can create a helper column to check if a cell should be highlighted.
Formula in G2 : =IFERROR(MATCH(CELL("row",A2)-1,$D$2:$D$5,0)>0,FALSE)
The idea behind this function is simply to check if the row of the data point corresponds with one of the random positions we have.
Finally, you would use a formula to define your conditional formatting by applying it to Column A and using =$G2 as the formula.
Note that:
The highlighing will reset everytime you change a cell provided that you have "Automatic calculations" turned ON.
There is a possibility that 2 or more of the random positions are the same, so you'll need to recalculate if that's an issue.
I am trying to chart in Excel a table that is built conditionally.
The table on the left comes from the table form the right and leaves cells blank if the corresponding ones on the other tables aren't numbers.
However, if I try to extend the range, in order to include the cells that have a formula but are blank, the x-axis behaves in a bizarre way and the x values will be 1,2,3 instead of the given ones.
I guess it doesn't consider numeric values any more as numbers and just orders the items on the x-axis.
What can I do to make it work properly?
Thank you!
If you don't mind showing a dot at 0,0 then this works. If your reference data are not numbers, then use 0....
Cell C3 formula: =IF(ISNUMBER(F3),F3,0)
Drag it where needed.
Output:
Instead of returning an empty string in your formula, return a NA value
Formula: =IF(ISNUMBER(E6);E6;NA())
If you need to hide those values, use conditional format (see this)
Let me know if it works
I need help making a scatterplot with multiple data series using named ranges. I made up some data in the attached pic, but my data looks similar to what is shown in the attached pic, except it goes on for a thousand rows. I would like to create a scatterplot where the first series x-values (column B) and y-values (column C) are those corresponding to Type 1 (column A) only, where the second series x and y values are those corresponding to Type 2 only, and so on and so on. Basically, I need a formula for a named range that scans column A, identifies all the Type 1s, then sets the range of x-values in column B to be those corresponding to Type 1 only. Same for the range of y-values in column C. Then repeat the process for Type 2, and so on. Essentially, I need a formula for conditional named ranges. My goal is to make a scatterplot similar to that shown in the attached pic (which I did manually the cumbersome way, not using named ranges). Any help you can give me would be greatly appreciated.
Excel_Example_Data
Excel does not automatically identify series based on row data. However, assuming that know the unique values that may come for type (column A) beforehand, you may use the below workaround. First, enter the formula =B2 in cell D2. This is simply to make the range selection easier later on and can be omitted but then you will have to select the disjointed range when making the chart by using Ctrl key.
Next, in row 1 from column E onward, enter the distinct values for Type that you expect will come in the data (see cells highlighted in Yellow). This is to simulate different series of data.
Now, simply enter this formula in cell E2:
=IF($A2=E$1,$C2,NA())
and drag it down and to the right till the last row and last column. If you look at the data, this has simply added the value of Y under the appropriate type and all other types are #N/A (this is required because any other text or blank will be considered ax 0 by the graph and it will mess up the view.
Once this is done, it is easy, simply select the range from D2 till last row and last column of your data and add the scatter chart. It will give you the view you are looking for. You may then modify the series name, chart title etc. by using the chart options.
Could anyone advise how to format the fill of cell based on percentile ranges? So for example, I have a row of values. I'd like to format the fill on those cells such that I have cell fill colour for three conditions: above the 90th, between 10th and 90th and below the 10th percentile. If I try to create a conditional formatting rule with a 3-color scale, I am not sure how to format the 10th to 90th percentile range.
So basically what I am asking is how to format a row of cells thresholding on a range.
Thanks in advance!
Using Excel 2013, might be slightly different path for older versions.
Highlight the cell range you want.
Home -> Conditional Formatting -> New Rule
Under New Rule, there should be 6 options, choose option Format only top or bottom ranked values. Choose Top, 10 (or whatever number you want), and click the box for % of the selected range.
Hit Format and go to Fill, and choose a background color.
Do the same thing, but now choose Bottom instead of Top.
This will highlight the top x% and bottom y%. Also, if you're open, you should also try Icon Sets and you can use Green/Yellow/Red circles or arrows to help.