How do I update the data label of a chart? - excel

For example, I have a pie chart, 95% of it is blue.
Now I update some excel fields that have to do with the blue area of the piechart, 95% then goes down to 90%.
Now I want to also update the Data label of the blue area because it is still 95% and not 90%, instead of changing it manually, how can I make excel update the labels for me?

First, you have to build the labels via formula somewhere on a worksheet. Once you've done that, you can link the chart's labels to the cell containing the "data labels"
To build your data labels, somewhere else on your worksheet (conveniently, in the adjacent column would be ideal), use Excel formula to build the desired label string, for example: ="Blue occupies "&TEXT(B3,"0%")
Repeat for the other points in the chart.
Once you've done that, here's how you link Data Labels to a cell reference (normally, Data Labels are linked to the underlying data value).
Select the data label
Then, place your cursor in Excel's Formula Bar, and enter the formula like ='Sheet2'!$C$3.
Now, that data label is associated by the formula, to the cell C3, which contains the desired data label that we built above. Repeat as needed.
Note: The sheet name is required in this formula. Use single-quotes around the sheet name if it contains spaces.

Related

Add a shape to a specific cell in Excel

Is it possible to fill a cell within a range (A1:H4) with a rectangle shape so that the entire cell is filled and when the range is sorted the rectangle shape stays with the cell it was placed into?
Original range with 3 shapes added for Washington and Roosevelt
After sorting on Name column this happens:
Is it possible to tie a shape to a particular cell?
EDIT: It appears if the shape fits within the size of the cell, then it 'stays' with the cell when the range is sorted?
If you sort across multiple columns using SORT() or using data->sort on the ribbon, it will keep the rows in tact and your colors will stay where they are. For example:
=SORT(A2:AH4)
will sort those 3 rows in ID# order and keep your colors with each row as it moves.
Okay - If the shapes need to sort along with the cells, it is necessary that the shape be completely contained within the cell.

How to look up data horizontally from vertical data?

I have a data set that is vertical and I am trying to use a lookup to fill a template on a second sheet.
The template I am trying to fill out is horizontal, what would be the best formula for this problem?
I have added an example with the first image being the data set, the second image is the template I am trying to fill out.
Would I have to do two look ups? I was thinking on the template I would have to do a lookup to get all the item no.s then I would have to do a second look up to obtain all the secondary information.
Use the TRANSPOSE formula.
If your dataset is in Sheet1 occupying cells A1:D5.
In Sheet2(your template sheet) use this formula in A1:
=TRANSPOSE(Sheet1!A1:D5)
Try this:
Select the range of data you want to rearrange, including any row or column labels, and press Ctrl+C.
Note: Ensure that you copy the data to do this, since using the Cut command or Ctrl+X won’t work.
Choose a new location in the worksheet where you want to paste the transposed table, ensuring that there is plenty of room to paste your data. The new table that you paste there will entirely overwrite any data / formatting that’s already there.
Right-click over the top-left cell of where you want to paste the transposed table, then choose Transpose:
After rotating the data successfully, you can delete the original table and the data in the new table will remain intact.

How to hide a specific row of Excel chart data table?

So right now I have a chart with 3 series, which will have 3 rows of data in the chart's data table. If I want to hide the last row in the data table, but keep the series in the chart, how can it be done? The only way I can think of is to create a block to cover that part, but is there a better way of doing it?
Edit: I'm looking for a way to show the series in chart, but not in chart data table.
Select the last row of chart data and format the cell's displayed text/number as ;;;. If the chart data is dynamic, then the last row can be identified with something like,
=row()=match(1e99, A:A)
This would enable you to create a conditional formatting rule that applies the ;;; cell number format to the last row.
Expanding on my comment to your question.
You could:
Make a new table on the worksheet that points, via formulas, to the range that the chart is made from.
In those formulas, use if() statements to toggle the values on/off based on whatever logic you are using to hide/show. Below I use a checkbox.
Remove the data table from your chart
Make the background of your chart area "No Fill" so it's transparent.
Line your chart x-series up with the formula based table so it looks like the data table for your chart
You can just make changes in the graphs.
Select the line graph series that you do not want to display in the chart.
Right click and click on "Format Data Series"
Click on "Fill & Line" (an icon of a paint)
Select "No Line"

Add data points to Excel stacked bar chart

I have a table with salary ranges for various titles and individual salaries (see below).
Data:
What I'd like to do, is to create a stacked bar (or column) chart in MS Excel (Office 365 ProPlus) which shows the ranges, as well as the individual salaries with employee names as data markers. Please note that the number of employees is not the same for each title, e.g. there are 2 clowns, but 3 jugglers and so on.
Here is what I'd like to achieve. I have manually added a couple of data markers for illustration by editing the image:
Desired chart:
With your horizontal bar chart already in place make sure it is a stacked horizontal chart, then create the data for the blue dots like in the table of my screenshot. Select B12 to C19 and copy. Then select the chart and use Paste Special. Paste with these options selected and all others unticked
new series
values in columns
Categories (X Labels) in First column
That will stack bars onto the existing chart. Select the stacked series and change the series chart type to Scatter chart.
The row position and the salary column are in the wrong order for our purpose. Using copy and paste, paste the row position into column D, then copy C11 to D19 and paste to B11.
Then add data labels with the option "Values from cells" and select A12 to A19.
Adjust the salary values and the formatting of the dots.

Trendline conditional formatting

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.

Resources