Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using more than one sheet for a pivot table in Google sheets

I'm trying to link three spreadsheets in Google Sheets by using the pivot tables functionality.

The problem that i have now is that i don't find a way to pull the data for more than one sheet. I can only operate the Pivot table with the information coming from only one. I have researched quite a lot, but my impression so far is that the documentation available for Google Docs is not so extensive at some point.

Basically what i need to do is the following:

Table 1(main):

Car Name | ModelId | ColorID
ford | 1 | 1
fiat | 2 | 2

Table 2:
ModelID | Name
1 | mustang
2 | bravo

Table 3:
ColorID | Name
1 | Red
2 | Blue

Resulting pivot table:
Car Name | Model| Color
ford | mustang | Red
fiat | bravo | Blue

In SQL statements i'm basically trying to simulate a JOIN. I also could write a javascript script but i would like to know if there is a simple way to achieve this without coding.

Thanks!

like image 566
Hector B Avatar asked Jul 03 '15 03:07

Hector B


People also ask

Can you create a pivot table from multiple worksheets Google Sheets?

How to make a pivot table from multiple sheets in Google spreadsheet? It often happens that the data, which is necessary for the analysis, is spread out into different tables. But the Pivot table can be built by using one data span only. You can't use the data from different tables to make a Google Sheets pivot table.

How do I use data from two worksheets in a pivot table?

To append the two tables into a single table which will be used to drive the Pivot Table, click Data (tab) -> Get & Transform Data (group) -> Get Data -> Combine Queries -> Append. In the Append dialog box, select the “Two Tables” option, then select each table from the two supplied dropdown fields.

Can Google Sheets pull data from multiple sheets?

IMPORTRANGE to import data from multiple Google sheets. As the name of the function suggests, IMPORTRANGE imports data from multiple Google spreadsheets into one sheet. Tip. The function helps Google Sheets pull data from another document as well as from other tabs from the same file.


1 Answers

This formula reproduces your example output and will update if more records are added to the 3 tables:

={"CarName","Model","Color"; Table1!A2:A, ARRAYFORMULA(IFERROR(VLOOKUP(Table1!B2:B,Table2!A:B,2,0))), ARRAYFORMULA(IFERROR(VLOOKUP(Table1!C2:C,Table3!A:B,2,0)))}

This example sheet shows the formula working.

like image 116
Chris Hick Avatar answered Nov 15 '22 12:11

Chris Hick