banner



how to create a relationship in excel

Excel is a powerful tool for data analysis and subsequent automation when handling large sets of data. You could be spending significant time analyzing tons of data using VLOOKUP, INDEX-MATCH, SUMIF, etc.

Thanks to the Excel Data Model, you can save precious time through automatic data reports. Find out how easily you can assign a relationship between two tables by using the Data Model and an illustration of such a relationship in a pivot table in the following section.

The Basic Requirements

You'll need Power Pivot and Power Query (Get & Transform) to accomplish several tasks while creating Excel Data Model. Here is how you can get these features in your Excel workbook:

How to Get Power Pivot

1. Excel 2010: You'll need to download the Power Pivot add-in from Microsoft and then install it for your Excel program on your computer.

2. Excel 2013: Office Professional Plus edition of Excel 2013 includes Power Pivot. But, you need to activate it before first use. Here is how:

  1. Click on File on the Ribbon of an Excel workbook.
  2. Then click on Options to open Excel Options.
  3. Now, click on Add-ins.
  4. Select COM Add-ins by clicking on the drop-down menu of the Manage box.
  5. Click on Go and then select the checkbox for Microsoft Power Pivot for Excel.

3. Excel 2016 and Later: You'll find the Power Pivot menu on the Ribbon.

How to Get Power Query (Get & Transform)

1. Excel 2010: You can download the Power Query add-in from Microsoft. After installation, Power Query will show up on the Ribbon.

2. Excel 2013: You need to activate Power Query by following the same steps that you just did to make Power Pivot functional in Excel 2013.

3. Excel 2016 and Later: You can find Power Query (Get & Transform) by going to the Data tab on Excel Ribbon.

Create Data Model by Importing Data to the Excel Workbook

For this tutorial, you can get pre-formatted sample data from Microsoft:

Download: Sample student data (data only) | Sample student data (complete model)

You can import a database with multiple related tables from many sources like Excel workbooks, Microsoft Access, websites, SQL Server, etc. Then you need to format the data set so that Excel can utilize it. Here are the steps that you can try:

1. In Excel 2016 and later editions, click on the Data tab and select New Query.

2. You will find several ways to import data from external or internal sources. Choose the one that suits you.

3. If using Excel 2013 edition, click on Power Query on the Ribbon and then select Get External Data to choose data for import.

4. You will see the Navigator box where you need to choose which tables you need to import. Click on the check box for Select multiple items to pick several tables for import.

5. Click on Load to complete the import process.

6. Excel will create a Data Model for you using these tables. You can see the table column headers in the PivotTable Fields listings.

You can also utilize Power Pivot functions like calculated columns, KPIs, hierarchies, calculated fields, and filtered datasets from Excel Data Model. For this purpose, you'll need to generate Data Model from a single table. You can try these steps:

1. Format your data in a tabular model by selecting all of the cells containing data and then click Ctrl+T.

2. Now, select the entire table and then click on the Power Pivot tab on the Ribbon.

3. From the Tables section, click on Add to Data Model.

Excel will create table relationships between related data from the Data Model. For this, there should be primary and foreign key relationships within the imported tables.

Excel utilizes the relationship information from the imported table as a foundation to generate connections between the tables in a Data Model.

Build Relationships Between the Tables in the Data Model

Now that you have a Data Model in your Excel workbook, you'll need to define relationships between the tables to create meaningful reports. You need to assign a unique field identifier or primary key to each table, like Semester ID, Class Number, Student ID, etc.

The Diagram View feature of Power Pivot will let you drag and drop those fields to build a relationship. Follow these steps to create table links in Excel Data Model:

1. On the Ribbon of the Excel workbook, click on the Power Pivot menu.

2. Now, click on Manage in the Data Model section. You'll see the Power Pivot editor as shown below:

3. Click on the Diagram View button located in the View section of the Power Pivot Home tab. You'll see table column headers grouped according to the table name.

4. You'll now be able to drag and drop the unique field identifier from one table to another. Following is the relationship schematic between the four tables of the Excel Data Model:

The following describes the linkage between tables:

  • Table Students | Student ID to table Grades | Student ID
  • Table Semesters | Semester ID to table Grades | Semester
  • Table Classes | Class Number to table Grades | Class ID

5. You can create relationships by choosing a pair of unique value columns. If there are any duplicates, you'll see the following error:

6. You'll notice Star (*) on one side and One (1) on the other in the Diagram View of relationships. It defines that a one-to-many relationship exists between the tables.

7. On the Power Pivot editor, click on the Design tab and then select Manage Relationships to know which fields make the connections.

Generate a PivotTable Using the Excel Data Model

You can now create a PivotTable or PivotChart to visualize your data from Excel Data Model. An Excel workbook may contain only one Data Model, but you can keep updating the tables.

Because data changes over time, you can continue to use the same model and save time when working with the same data set. You'll notice more time savings when working on data in thousands of rows and columns. To create a PivotTable based report, follow these steps:

1. On the Power Pivot editor, click on the Home tab.

2. On the Ribbon, click on PivotTable.

3. Choose any one between New Worksheet or Existing Worksheet.

4. Select OK. Excel will add a PivotTable that will show the Field List pane on the right.

Following is a holistic view of a pivot table created by utilizing the Excel Data Model for the sample student data used in this tutorial. You can also create professional pivot tables or charts from big data using the Excel Data Model tool.

Transform Complex Data Sets Into Simple Reports Using Excel's Data Model

Excel Data model utilizes the benefits of creating relationships between tables to produce meaningful pivot tables or charts for data reporting purposes.

You can continuously update the existing workbook and publish reports on updated data. You don't have to edit formulas or invest time in scrolling through thousands of columns and rows each time the source data updates.

How to Create a Pivot Table in Excel

Learn how to create pivot tables in Excel and how to use them to draw out the information you want to see.

Read Next

About The Author

Tamal Das (261 Articles Published)

Tamal is a freelance writer at MakeUseOf. After gaining substantial experience in technology, finance, and business processes in his previous job in an IT consulting company, he adopted writing as a full-time profession 3 years ago. While not writing about productivity and the latest tech news, he loves to play Splinter Cell and binge-watch Netflix/ Prime Video.

More From Tamal Das

Subscribe to our newsletter

Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!

Click here to subscribe

how to create a relationship in excel

Source: https://www.makeuseof.com/create-relationships-between-tables-data-model-excel/

Posted by: cundiffthaveling73.blogspot.com

0 Response to "how to create a relationship in excel"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel