0

I have the following dataset that I would like to graph in excel.Dataset The data is from OurWorldInData.org if you need the full dataset. It has a country, date, and new cases columns. I would like to make a line chart which shows each country's new case progression by date (each line is a country, see image below). This could be done, for example, for a number of developed countries. I can make the chart if I select the data manually. However, I need to update this on a daily basis so it would be very helpful if I can find a way to do this more easily. I tried vlookups, named ranges, etc.. but nothing has been working for me so far. Desired Result

2 Answers 2

0

Each day, I can download the file (manually or programmatically) to a location on my computer:

enter image description here

To make this easy, I'll just create another file that will analyse this data file. I create a new Excel file, then I use Data>Get & Transform Data>From Text/CSV. I select the raw data file and click Import. On the summary dialog, I click "Load":

enter image description here

This loads the data into the spreadsheet. From here, I can use Insert>Pivot Chart. I put location in Legend (series), date in Axis (categories) and 'new cases' in Values. After the chart is created, I found that the dates had been grouped to quarters and years. To undo that, I right-clicked the date field in the pivot table and chose 'Ungroup'.

I then right-clicked the chart and selected 'Change series chart type' and changed the chart type to a line chart:

enter image description here

Format and position your chart however you like it.

One last step to set up this analysis file is to go to the sheet with the data on it and right click the query name in the Queries & Connections tab and choose Properties:

enter image description here

In the properties dialog, ensure 'Refresh data when opening the file' is selected:

enter image description here

Each day, download the file and overwrite the file you downloaded yesterday. When you open the analysis file, the query will refresh and pull all the data into the file again, including the new day's cases.

You then simply need to refresh the pivot table to see the results:

enter image description here

This will be slightly easier than changing the pivot table data source range each day. Open the file, refresh the pivot.

0
  1. Create a pivot table based on your table.
  2. Add Location to the Legend (Series), add Date to Axis (Categories), add New cases to Values

enter image description here

This will be your pivot table's content. enter image description here

  1. On the PivotTable Analyze tab, click on Pivot Chart. Select Line chart.
  2. To smoothen the lines, select a data series, right-click select Format Data Series.

enter image description here

Enable Smoothen line on the Fill & Line

enter image description here

  1. Your chart will look like the picture below. enter image description here

I have only use 3 countries and 3 dates based on the image from the OP. Add the others countries and more dates.

2
  • Hi Reddy, Thank you for answering the question! One more question if you do not mind. I have a specific template that I have to follow. I already have an excel graph to which the template is applied (I do not make the templates myself, so idk how to do them). Is there a way to transfer the data from the pivot chart to the normal graph?
    – Moe
    Commented May 2, 2021 at 17:39
  • If the question is successfully answered, mark it as answered. Please visit the Tour and What should I do when someone answers my question. Commented May 2, 2021 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .