Chart Source Data Query

M10Ant

New Member
Joined
Dec 30, 2021
Messages
36
Office Version
  1. 365
Platform
  1. Windows
I have a source table that shows a list of stocks and the total amount invested in each (specified in both dollars and percentages relative to the entire portfolio)

I'd like to display the percentage figures of the stocks in a doughnut chart, displaying those with a percentage figure of 5% or more as individual "slices" and any with a figure of less than this to all be combined in a single slice named "Other".

Ideally I'd like to achieve this by using an amended version of the source data that has already summarized these small percentage figures together (e.g. as a single row).

The table on the left is the original source data. My attempt at the "modified" source data to feed the chart is shown on the far right.

I'm using a helper column of [Combine as Single Pie Slice?] in the original source table to determine which stocks have a percentage figure below 5%, and those that have a figure above it. This is then used to help construct the 'modified' source data shown on the right.

In the modified source data (which isn't actually a table), the formula for [Amount Invested] and [Relative % in Portfolio] cells of the "Other" row can be seen in the Xl2bb output.

Below this is a filtered list of the stocks that should display individually in the chart. That list is a dynamic spill array (formula is in first cell of that array, where "AMZN" resides).

Collectively, all these rows (except the blank row between them) form the actual data I want the chart to use (specifically the [Relative % in Portfolio] column for the data, and [Stock] for the data labels)

Currently this isn't working brilliantly as the chart is giving two doughnut rings rather than just the one and there are are also blank entries in the chart's Legend which is a bit off. I suspect this all could be due to the chart's source data being a combination of a standalone row of data - the "Other" row - plus the dynamic spill array. If I get rid of the empty row between the "Other" row and the dynamic spill array, this still give two doughnut rings in the chart. I only need the one!

I think I just need some way to construct the modified source data so that the chart sees it all as one (and ideally as a single table).

Pie Chart Data.xlsx
ABCDEFGH
1Max. [Relative % in Portfolio] value for combining assets as single "other" pie slice:5
2
3Original Source DataModified Source Data for Pie Chart
4
5StockAmount InvestedRelative % in PortfolioCombine as Single Pie Slice?StockAmount InvestedRelative % in Portfolio
6APPL$2,500.003.29YOther16,000.0021.05
7AMZN$10,000.0013.16N
8COST$2,500.003.29YAMZN10,000.0013.16
9DIS$2,500.003.29YGOOG10,000.0013.16
10GOOG$10,000.0013.16NMA10,000.0013.16
11HD$2,500.003.29YMSFT10,000.0013.16
12JNJ$1,000.001.32YTSLA10,000.0013.16
13KO$1,000.001.32YV10,000.0013.16
14MA$10,000.0013.16N
15META$2,500.003.29Y
16MSFT$10,000.0013.16N
17PG$500.000.66Y
18TSLA$10,000.0013.16N
19UNH$1,000.001.32Y
20V$10,000.0013.16N
21Total$76,000.00100
Sheet1
Cell Formulas
RangeFormula
C6:C20C6=IFERROR( ([@[Amount Invested]]/tblOrigSourceData[[#Totals],[Amount Invested]])*100,"")
D6:D20D6=IF([@[Relative % in Portfolio]]<$F$1,"Y","N")
G6G6=SUMIFS(tblOrigSourceData[Amount Invested],tblOrigSourceData[Combine as Single Pie Slice?],"=Y")
H6H6=SUMIFS(tblOrigSourceData[Relative % in Portfolio],tblOrigSourceData[Combine as Single Pie Slice?],"=Y")
F8:H13F8=FILTER(FILTER(tblOrigSourceData,(tblOrigSourceData[Combine as Single Pie Slice?]="N")),{1,1,1,0})
B21B21=SUBTOTAL(109,[Amount Invested])
C21C21=SUBTOTAL(109,[Relative % in Portfolio])
Dynamic array formulas.


Chart:
Doghnut Chart.png
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,816
Messages
6,181,139
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top