Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8220557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:33:46+00:00 2026-06-07T13:33:46+00:00

What I’m trying to do is create a 2d stacked chart where the position

  • 0

What I’m trying to do is create a 2d stacked chart where the position of my series means something like where they are in a queue (position 1 – being the upermost section of the stacked column is last to get served and position 2- is the bottom section of the stacked column will be first up).

I’ve formatted my data to looks like this (but this can be easily changed if the solution needs it to be):

Task 1   Task 2   Task 3   <- x-axis  
A  100   B 400    B 510    <- This row is position 1      
B  200   A 200    A 300    <- This row is position 2   
^-Legend

The issue I’m having is that I want all tasks on the same chart and excel isn’t recognizing at every x the position of A and B. It simply is assuming from Column 1 that Row 2 is A and Row 3 is B and is not adjusting in each subsequent column based on the A/B keys. I’m wondering if there’s a way to do this.

As a recap, is it possible to get a 2d stacked chart with multiple x-values that recognizes the position of your legend keys (whether it should be at the top or bottom of the column) at each unique x-value. Any solution either VBA or in-sheet formula I haven’t had any luck with.Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:33:48+00:00Added an answer on June 7, 2026 at 1:33 pm
    'Run this macro from the sheet containing your data, after highlightling the data.
    Sub Macro3()
    
      'The below code assumes that you have already selected
      'the columns containing your data and that the first column,
      'and every 2nd column after that contains your legend keys.
      Dim rng As Range
      Set rng = Selection
    
      Dim colNum As Integer
      Dim rowNum As Integer
      Dim strLegend As String
      Dim rowStart As Integer
      Dim colStart As Integer
      Dim strSeries As String
      Dim i As Integer
      Dim seriesNum As Integer
      Dim shtName As String
    
      rowStart = rng.Row
      colStart = rng.Column
      shtName = ActiveSheet.Name & "!"
    
      'Creates an empty chart...
      ActiveSheet.Shapes.AddChart.Select
      '...of type StackedColumn.
      ActiveChart.ChartType = xlColumnStacked
    
      seriesNum = 0
      'Select all the cells that match the legend in the first column.
      For rowNum = 0 To rng.Rows.Count - 1
        strLegend = Cells(rowStart + rowNum, colStart).Value
        strSeries = "=" & shtName & Cells(rowStart + rowNum, colStart + 1).Address
        For colNum = 2 To rng.Columns.Count - 1 Step 2
            For i = 0 To rng.Rows.Count - 1
                If Cells(rowStart + i, colStart + colNum).Value = strLegend Then
                    strSeries = strSeries & "," & shtName & Cells(rowStart + i, colStart + colNum + 1).Address
                    Exit For
                End If
            Next
        Next
        'Create a new series.
        ActiveChart.SeriesCollection.NewSeries
        seriesNum = seriesNum + 1
        'Set the legend.
        ActiveChart.SeriesCollection(seriesNum).Name = strLegend
        'Set the X axis labels to nothing, so the default is used.
        ActiveChart.SeriesCollection(seriesNum).XValues = ""
        'Set the series data.
        ActiveChart.SeriesCollection(seriesNum).Values = strSeries
      Next
      'An extra series gets added automatically???
      'This code removes it.
      If ActiveChart.SeriesCollection.Count > rng.Rows.Count Then
        ActiveChart.SeriesCollection(rng.Rows.Count + 1).Delete
      End If
    End Sub
    

    This code requires that your legend values and number values each be in separate columns like shown below. The labels ‘Task 1’, etc. are not used in this example.

    A | 100 | B | 400 | B | 510 
    B | 200 | A | 200 | A | 300
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.