ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Convert data from a table to a chart? (https://www.excelbanter.com/charts-charting-excel/19541-convert-data-table-chart.html)

Rockne06

Convert data from a table to a chart?
 
I have 30 years of data in monthly increments. The years are listed by rows
and the months are listed by columns. How can I get this into a line chart?

Jess

Select all the data you wnt to put into the chart including the headings and
then InsertChart and select the line chart option.

"Rockne06" wrote:

I have 30 years of data in monthly increments. The years are listed by rows
and the months are listed by columns. How can I get this into a line chart?


John Mansfield

Jess,

Assume the first table starts in A1 and covers the
range A1:D8. The macro below will rearrange
the table into columns. From here you can
sort the data and then plot it as one line.


2001 2002 2003
Jan 1 5 9
Feb 2 6 10
Mar 3 7 11


Sub RearrangeData()
Dim Rng1 As Range, Rng2 As Range
Set Rng2 = Sheets("Sheet1").Range("C8")
For Each Rng1 In Range("B2:D4")
Rng2.Formula = "=" & Rng1.Address
Rng2.Offset(0, -1) = "=$A" & Rng1.Row
Rng2.Offset(0, -2) = Range("A1").Offset(0, Rng1.Column - 1)
Set Rng2 = Rng2.Offset(1, 0)
Next Rng1
End Sub


Year Month Number
2001 Jan 1
2002 Jan 5
2003 Jan 9
2001 Feb 2
2002 Feb 6
2003 Feb 10
2001 Mar 3
2002 Mar 7
2003 Mar 11

----
Regards,
John Mansfield
http://www.pdbook.com



"Jess" wrote:

Select all the data you wnt to put into the chart including the headings and
then InsertChart and select the line chart option.

"Rockne06" wrote:

I have 30 years of data in monthly increments. The years are listed by rows
and the months are listed by columns. How can I get this into a line chart?



All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com