View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
[email protected] myemail.an@googlemail.com is offline
external usenet poster
 
Posts: 25
Default Creating a pivot table which resembles a SQL 'group by'

Hi all,

I was hoping you can help me with this question: how do I build a
pivot table which looks like a "group by" operation in a database?

Let's say I have this table:

Continent Product Sales
Asia Red 100
Asia Yellow 200
Asia Red 100
Asia Yellow 300
Europe Red 100
Europe Yellow 200
Europe Red 100
Europe Yellow 300


An Excel Pivot table will return this:

Row Labels Sum of Total sales
Asia 700
Red 200
Yellow 500
Europe 700
Red 200
Yellow 500
Grand Total 1400

whereas a statement like:

select Continent, Product, sum(Sales) as TotalSales
from MyTable
group by Continent, Product

in SQL will return:

Continent Product Total sales
Asia Red 200
Asia Yellow 500
Europe Red 200
Europe Yellow 500

Is there an easy way to obtain the latter in Excel?
Thanks!