Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

How to make a comparison table to display two different

0

Hello.

I am not sure if you can help me. I just don't know...

I would love to know, how to make comparison chart to display two varying sets of data.

I have two workbooks.

One of the workbook have 181 worksheets. "Each worksheet name after a country and have its own data.

Next

The other workbook have 185 worksheets."Each worksheet name after a country and have its own data.

This is the hard part:

#1 How can I link both workbook data together using macros? Country vs Country or USA vs USA as an example.

#2 How can I create a comparison chart to display two varying sets of data, both varying sets of data beginning with the zero values?

If you think I sound crazy. Please just say so lol. I am not sure if you are open in helping me. If so, I am looking for someone to point me to the right direction.

Thanks in advance

Cheers,

https://drive.google.com/file/d/1mmsL54lWBSVNsrP0INleJe-uW8U-2VVD/view?usp=sharing

https://drive.google.com/file/d/1JigNJKkY2IMGg4-aSXu0NnFnRRuvb6jx/view?usp=sharing

Answer
Discuss

Answers

0
Selected Answer

Change your conceptual approach: There is no need to "link the workbooks together". Instead, you may want to take data from both and do something with that data. Like, you take USA GDP growth and compare it to employment figures from Mexico - whatever. Mark my words. The job is to "take the data" and "do something with it". Two distinct actions. No mention of "link".

Take the data. You can open several workbooks in one instance of Excel. You can access any of the open workbooks using VBA and read/write to any of its cells as if they were in one workbook. Just specify Workbook, Worksheet, Cell.Address and there you go. To open a workbook programmatically you need to know its exact location: Drive\Path\Name\Extension. But with that same information you can also extract data from a closed workbook. You would use that method if the extraction is a single item, like a column or a sheet, as opposed to evaluations with, say, COUNTIFS or SUMIFS.

Do something. Since your aim is to create a chart you would probably copy the data to a third workbook and minipulate them there. Imagine the third workbook to be the one that contains the code. You open that workbook, click a button and a form opens. On the form you specify two countries (as worksheets) and columns (as data ranges). The code imports the two data sets automatically and creates the charts from them. Then you call up the same form again, specify another pair of columns and get another chart. These charts you might save or print in whatever format you prefer.

As you see, the above is quite an advanced version. The obvious way to start is to copy two columns manually and create a chart. To answer your question more precisely: You don't link the workbooks. Instead you import data from them into a third location.

Discuss

Discussion

Thank you for your feed back. I really appricate your suggestions and I love how you broke it up for me to understand. I am sorry, with your suggestions, I am wondering how can I do that? As I am new to excel. If you are open in showing me an example of the third work book. What do you suggest I do?

Thanks in advance
Matrix2021 (rep: 2) Jul 17, '20 at 5:35 am
The thing is that you were not descriptive enough in what you want to do. You can compare data a million different ways from Sunday. You need to make the third workbook how you want it - maybe you need to first copy some data from the other workbooks there and then insert a chart with both sets of data by hand and then get it how you want it. If you do not know how to copy/paste data and insert a chart, then creating or managing a macro might be an impossible task. So start by copy/pasting the data that you want to the workbook you want, put both sets of data next to each other, then go to Insert > Charts on the Ribbon Menu and probably select a bar chart; try this out and see how it goes.
don (rep: 1989) Jul 21, '20 at 2:35 am
Ok Thanks for the information. Would proceed with the recommendation given.

Thanks in advance
Matrix2021 (rep: 2) Jul 22, '20 at 9:40 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login