Make Pie Chart Aggregate Data from Formatted Table

pahy96

New Member
Joined
Jan 30, 2016
Messages
23
Over the last few days, I have been teaching myself a few things in VBA in order to create a more efficient personal finance tracker that allows me to enter a few items into a user form and automatically populates a Formatted Table. Along with this functionality, I am wanting to have a Pie chart that takes two columns, one with Category Labels, and one with Prices and simply sums the prices that fall in matching Category Labels.

For example, if I have three rows with Food as the Category Label and Prices of 25, 30, and 50, I want the pie chart to show one slice for Food with a total price of 105 (rather than three slices with each individual price).

I am hoping to do this without any additional calculation columns/extra steps and am willing to do this in VBA if necessary. However, I am as green as it comes when talking about VBA, so if there is a solution outside of VBA that would be great.

Thanks!
 

pahy96

New Member
Joined
Jan 30, 2016
Messages
23
Welcome to MrExcel.

You could use a Pivot Table and Pivot Chart.
Yeah, I was hoping to avoid that extra step. Since I will have 12 worksheets (one for each month), I didn't want to have 12 additional worksheets of raw data where the pivot tables would be pulling from. If there isn't a more simple solution, would it be faster to create a summary table using vlookups and have the pie chart created from that instead? I'm more thinking out loud than sticking to one idea or another.
 

pahy96

New Member
Joined
Jan 30, 2016
Messages
23
Why don't you put all your data on one worksheet with a column for the date?
Ok, I'll run with the pivot table idea. My question would then be how I can add data to the table without having to either expand the data reference for the pivot table or manually refresh the pivot table.

Here is the line of VBA code I am currently using to input a new row of data:

emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1

This is simply finds the next empty row, but I am under the assumption that simply adding data to the next empty row won't be captured by the active pivot table.
 

Forum statistics

Threads
1,081,860
Messages
5,361,734
Members
400,652
Latest member
cortexnotion

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top