Note: The other languages of the website are Google-translated. Back to English
Log in  \/ 
Register  \/ 


How to extract data from chart or graph in Excel?

In Excel, we usually use chart to show data and trend for more clearly viewing, but in sometimes, maybe the chart is a copy and you haven’t the original data of the chart as below screenshot shown. In this case, you may want to extract the data from this chart. Now this tutorial is talking about data extracting from a chart or graph.
Extract data from chart with VBA

arrow blue right bubble Extract data from chart with VBA

1. You need to create a new worksheet and rename it as ChartData. See screenshot:


2. Then select the chart you want to extract data from and press Alt + F11 keys simultaneously, and a Microsoft Visual Basic for Applications window pops.

3. Click Insert > Module, then paste below VBA code to the popping Module window.

VBA: Extract data from chart.

Sub GetChartValues()
	Dim xNum As Integer
	Dim xSeries As Object
	xCount = 2
	xNum   = UBound(Application.ActiveChart.SeriesCollection(1).Values)
	Application.Worksheets("ChartData").Cells(1, 1) = "X Values"
	With Application.Worksheets("ChartData")
		.Range(.Cells(2, 1), _
		.Cells(xNum + 1, 1)) = _
	End With
	For Each xSeries In Application.ActiveChart.SeriesCollection
		Application.Worksheets("ChartData").Cells(1, xCount) = xSeries.Name
		With Application.Worksheets("ChartData")
			.Range(.Cells(2, xCount), _
			.Cells(xNum + 1, xCount)) = _
		End With
		xCount = xCount + 1
End Sub

4. Then click Run button to run the VBA. See screenshot:


Then you can see the data is extracted to ChartData sheet.


1. You can format the cells as you need.


2. The data of the selected chart is extracted to the first cell of the ChartData sheet in default.

Tip: If you usually use complex charts in Excel, which will be troublesome as you create them very time, here with the Auto Text tool of Kutools for Excel, you just need to create the charts at first time, then add the charts in the AutoText pane, then, you can reuse them in anywhere anytime, what you only need to do is change the references to match your real need.  Click for free download it now.
doc conditional formatting stacked bar chart 12

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Radhika · 7 months ago
    i tried above & it says "Compile error: Method or Data Member not found"

    • To post as a guest, your comment is unpublished.
      Mr. Đạt · 4 months ago
      mong mọi người giúp đỡ làm cách nào để lấy số liệu từ biểu đồ này với ạ! 
  • To post as a guest, your comment is unpublished.
    tarshul · 8 months ago
    i m getting below error while running that command.

    this error comes in that command which starts from xnum = UBound(......) etc

    Run-Time error '91'

    object variable or with block variable not set
    • To post as a guest, your comment is unpublished.
      Sunny · 8 months ago
      Hi, tarshul, you need to create a new worksheet named ChartData before you running the code, the data will be place in the new worksheet ChartData.
      • To post as a guest, your comment is unpublished.
        Tarshul · 7 months ago
        Hi sunny,

        I already create new worksheet as u told but still getting same error.

  • To post as a guest, your comment is unpublished.
    Astro · 4 years ago
    This doesn't appear to work for a scatter plot as it only extracts one set of "x" data. How can I amend it to extract all "x" data sets?
    • To post as a guest, your comment is unpublished.
      Sunny · 4 years ago
      Sorry I did not found the solution about that.
      • To post as a guest, your comment is unpublished.
        Carlos · 4 years ago
        i've tried with a scatter plot graph as well, but only get one line of valor.

        i need so much to find a way to extract data from scatterplot graphs.
  • To post as a guest, your comment is unpublished.
    Ian · 4 years ago
    I failed to get the prices of a fund chart on my mac excel 2011 . Run time error '91' object variable or block variable not set . Don't know how to debug . Appreciate any help .
  • To post as a guest, your comment is unpublished.
    jignesh · 4 years ago
    Very useful and perfect
  • To post as a guest, your comment is unpublished.
    Berk · 4 years ago
    gives me values that i created chart with not all the values in range
  • To post as a guest, your comment is unpublished.
    Leo · 4 years ago
    Amazing command, thanks a lot!

    I used it with a pivot chart and it works!
  • To post as a guest, your comment is unpublished.
    Alex · 5 years ago
    Thank you. This was really helpful!
  • To post as a guest, your comment is unpublished.
    Henning · 6 years ago
    Good day, i seem to run into a Run-tome error '-2147467259 (80004005)'
    Method 'XValues' of object 'series failed'